Class: OpscodeAcl::GroupList

Inherits:
Chef::Knife
  • Object
show all
Defined in:
lib/chef/knife/group_list.rb

Instance Method Summary collapse

Instance Method Details

#is_usag?(gname) ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/chef/knife/group_list.rb', line 35

def is_usag?(gname)
  gname.length == 32 && gname =~ /^[0-9a-f]+$/
end

#remove_usags(groups) ⇒ Object



31
32
33
# File 'lib/chef/knife/group_list.rb', line 31

def remove_usags(groups)
  groups.select { |gname| !is_usag?(gname) }
end

#runObject



24
25
26
27
28
29
# File 'lib/chef/knife/group_list.rb', line 24

def run
  chef_rest = Chef::REST.new(Chef::Config[:chef_server_url])
  groups = chef_rest.get_rest("groups").keys.sort
  
  ui.output(remove_usags(groups))
end