Method: Mac::Group#group_get
- Defined in:
- lib/beaker/host/mac/group.rb
#group_get(name, &block) {|String| ... } ⇒ String
Gets the group information in /etc/group format
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/beaker/host/mac/group.rb', line 31 def group_get(name, &block) execute("dscacheutil -q group -a name #{name}") do |result| fail_test "failed to get group #{name}" unless result.stdout =~ /^name: #{name}/ gi = Hash.new # group info result.stdout.each_line { |line| pieces = line.split(': ') gi[pieces[0].to_sym] = pieces[1].strip if pieces[1] != nil } answer = "#{gi[:name]}:#{gi[:password]}:#{gi[:gid]}" yield answer if block_given? end end |