Module: Aix::Group
Instance Attribute Summary
Attributes included from Beaker::CommandFactory
Instance Method Summary collapse
- #group_absent(name, &block) ⇒ Object
- #group_get(name) ⇒ Object
- #group_gid(name) ⇒ Object
- #group_list ⇒ Object
- #group_present(name, &block) ⇒ Object
Methods included from Beaker::CommandFactory
Instance Method Details
#group_absent(name, &block) ⇒ Object
33 34 35 |
# File 'lib/beaker/host/aix/group.rb', line 33 def group_absent(name, &block) execute("if lsgroup #{name}; then rmgroup #{name}; fi", {}, &block) end |
#group_get(name) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/beaker/host/aix/group.rb', line 12 def group_get(name) execute("lsgroup #{name}") do |result| fail_test "failed to get group #{name}" unless /^#{name} id/.match?(result.stdout) yield result if block_given? result end end |
#group_gid(name) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/beaker/host/aix/group.rb', line 21 def group_gid(name) execute("lsgroup -a id #{name}") do |result| # Format is: # staff id=500 result.stdout.split('=').last.strip end end |
#group_list ⇒ Object
4 5 6 7 8 9 10 |
# File 'lib/beaker/host/aix/group.rb', line 4 def group_list execute("lsgroup -a ALL") do |result| yield result if block_given? result.stdout.lines.map(&:strip) end end |
#group_present(name, &block) ⇒ Object
29 30 31 |
# File 'lib/beaker/host/aix/group.rb', line 29 def group_present(name, &block) execute("if ! lsgroup #{name}; then mkgroup #{name}; fi", {}, &block) end |