Class: Chef::Knife::RoleShow

Inherits:
Knife
  • Object
show all
Includes:
Core::MultiAttributeReturnOption
Defined in:
lib/chef/knife/role_show.rb

Instance Method Summary collapse

Methods included from Core::MultiAttributeReturnOption

included

Instance Method Details

#runObject



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/chef/knife/role_show.rb', line 33

def run
  @role_name = @name_args[0]

  if @role_name.nil?
    show_usage
    ui.fatal("You must specify a role name.")
    exit 1
  end

  role = Chef::Role.load(@role_name)
  output(format_for_display(config[:environment] ? role.environment(config[:environment]) : role))
end