Class: OpscodeAcl::GroupShow
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- OpscodeAcl::GroupShow
- Defined in:
- lib/chef/knife/group_show.rb
Instance Method Summary collapse
Instance Method Details
#annotate_usags(group) ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/chef/knife/group_show.rb', line 45 def annotate_usags(group) annotated = group["groups"].map do |name| user = @user_map[:usags][name] || "" {"group_id" => name, "user_usag" => user} end group["annotated_groups"] = annotated group end |
#run ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/chef/knife/group_show.rb', line 29 def run @user_map = if ::File.exists?("actor-map.yaml") YAML.load(IO.read("actor-map.yaml"))[:user_map] else {:users => {}, :usags => {}} end group_name = name_args[0] if !group_name || group_name.empty? ui.error "must specify a group name" exit 1 end chef_rest = Chef::REST.new(Chef::Config[:chef_server_url]) group = chef_rest.get_rest("groups/#{group_name}") ui.output(annotate_usags(group)) end |