Sha256: f16deddee12f6041e48c75b82d4d651b1278842f9b4734a92a6107d54fd0ac58

Contents?: true

Size: 723 Bytes

Versions: 52

Compression:

Stored size: 723 Bytes

Contents

module Aix::User
  include Beaker::CommandFactory

  def user_list(&block)
    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, &block)
    execute("lsuser #{name}") do |result|
      fail_test "failed to get user #{name}" unless result.stdout =~  /^#{name} id/

      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

52 entries across 52 versions & 1 rubygems

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