Sha256: a33d80ad2f5fbefc0ea977485670a4ae54e5f81de42b71d3c8242cde86c2eafc

Contents?: true

Size: 828 Bytes

Versions: 52

Compression:

Stored size: 828 Bytes

Contents

module Aix::Group
  include Beaker::CommandFactory

  def group_list(&block)
    execute("lsgroup -a ALL") do |result|
      yield result if block_given?

      result.stdout.lines.map(&:strip)
    end
  end

  def group_get(name, &block)
    execute("lsgroup #{name}") do |result|
      fail_test "failed to get group #{name}" unless result.stdout =~ /^#{name} id/

      yield result if block_given?
      result
    end
  end

  def group_gid(name)
    execute("lsgroup -a id #{name}") do |result|
      # Format is:
      # staff id=500
      result.stdout.split('=').last.strip
    end
  end

  def group_present(name, &block)
    execute("if ! lsgroup #{name}; then mkgroup #{name}; fi", {}, &block)
  end

  def group_absent(name, &block)
    execute("if lsgroup #{name}; then rmgroup #{name}; fi", {}, &block)
  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
beaker-4.38.1 lib/beaker/host/aix/group.rb
beaker-4.38.0 lib/beaker/host/aix/group.rb
beaker-4.37.2 lib/beaker/host/aix/group.rb
beaker-4.37.1 lib/beaker/host/aix/group.rb
beaker-4.37.0 lib/beaker/host/aix/group.rb
beaker-4.36.1 lib/beaker/host/aix/group.rb
beaker-4.36.0 lib/beaker/host/aix/group.rb
beaker-4.35.0 lib/beaker/host/aix/group.rb
beaker-4.34.0 lib/beaker/host/aix/group.rb
beaker-4.33.0 lib/beaker/host/aix/group.rb
beaker-4.32.0 lib/beaker/host/aix/group.rb
beaker-4.31.0 lib/beaker/host/aix/group.rb
beaker-4.30.0 lib/beaker/host/aix/group.rb
beaker-4.29.1 lib/beaker/host/aix/group.rb
beaker-4.29.0 lib/beaker/host/aix/group.rb
beaker-4.28.1 lib/beaker/host/aix/group.rb
beaker-4.28.0 lib/beaker/host/aix/group.rb
beaker-4.27.1 lib/beaker/host/aix/group.rb
beaker-4.27.0 lib/beaker/host/aix/group.rb
beaker-4.26.0 lib/beaker/host/aix/group.rb