Sha256: d455889908cddc7884939b5de4cbde67b320cd018b925956fd0ce830ab1467a3

Contents?: true

Size: 713 Bytes

Versions: 8

Compression:

Stored size: 713 Bytes

Contents

module Aix::User
  include Beaker::CommandFactory

  def user_list()
    execute("lsuser ALL") do |result|
      users = []
      result.stdout.each_line do |line|
        users << line.split(' ')[0]
      end

      yield result if block_given?

      users
    end
  end

  def user_get(name)
    execute("lsuser #{name}") do |result|
      fail_test "failed to get user #{name}" unless /^#{name} id/.match?(result.stdout)

      yield result if block_given?
      result
    end
  end

  def user_present(name, &block)
    execute("if ! lsuser #{name}; then mkuser #{name}; fi", {}, &block)
  end

  def user_absent(name, &block)
    execute("if lsuser #{name}; then rmuser #{name}; fi", {}, &block)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
beaker-4.42.0 lib/beaker/host/aix/user.rb
beaker-4.41.2 lib/beaker/host/aix/user.rb
beaker-4.41.1 lib/beaker/host/aix/user.rb
beaker-4.41.0 lib/beaker/host/aix/user.rb
beaker-4.40.2 lib/beaker/host/aix/user.rb
beaker-4.40.1 lib/beaker/host/aix/user.rb
beaker-4.40.0 lib/beaker/host/aix/user.rb
beaker-4.39.0 lib/beaker/host/aix/user.rb