Class: Opc::OpcUserShow

Inherits:
Chef::Knife
  • Object
show all
Includes:
Chef::Mixin::RootRestv0
Defined in:
lib/chef/knife/opc_user_show.rb

Instance Method Summary collapse

Methods included from Chef::Mixin::RootRestv0

#root_rest

Instance Method Details

#runObject



31
32
33
34
35
36
37
38
39
# File 'lib/chef/knife/opc_user_show.rb', line 31

def run
  user_name = @name_args[0]
  results = root_rest.get("users/#{user_name}")
  if config[:with_orgs]
    orgs = root_rest.get("users/#{user_name}/organizations")
    results["organizations"] = orgs.map { |o| o["organization"]["name"] }
  end
  ui.output results
end