Class: Chef::Knife::ClientKeyShow
Overview
Implements knife client key show using Chef::Knife::KeyShow as a service class.
Instance Attribute Summary collapse
Attributes inherited from Chef::Knife
#name_args, #ui
Instance Method Summary
collapse
Methods inherited from Chef::Knife
#api_key, #apply_computed_config, category, chef_config_dir, common_name, #config_file_settings, config_loader, #configure_chef, #create_object, #delete_object, dependency_loaders, deps, #format_rest_error, guess_category, #humanize_exception, #humanize_http_exception, inherited, load_commands, load_config, load_deps, #maybe_setup_fips, #merge_configs, msg, #noauth_rest, #parse_options, reset_config_loader!, reset_subcommands!, #rest, run, #run_with_pretty_exceptions, #server_url, #show_usage, snake_case_name, subcommand_category, subcommand_class_from, subcommand_files, subcommand_loader, subcommands, subcommands_by_category, #test_mandatory_field, ui, unnamed?, use_separate_defaults?, #username
#constantize, #convert_to_class_name, #convert_to_snake_case, #filename_to_qualified_string, #normalize_snake_case_name, #snake_case_basename
#enforce_path_sanity
Constructor Details
Returns a new instance of ClientKeyShow.
34
35
36
37
|
# File 'lib/chef/knife/client_key_show.rb', line 34
def initialize(argv = [])
super(argv)
@service_object = nil
end
|
Instance Attribute Details
the name of the client that this key is for
29
30
31
|
# File 'lib/chef/knife/client_key_show.rb', line 29
def actor
@actor
end
|
Instance Method Details
#actor_missing_error ⇒ Object
48
49
50
|
# File 'lib/chef/knife/client_key_show.rb', line 48
def actor_missing_error
"You must specify a client name"
end
|
#apply_params!(params) ⇒ Object
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/chef/knife/client_key_show.rb', line 60
def apply_params!(params)
@actor = params[0]
if @actor.nil?
show_usage
ui.fatal(actor_missing_error)
exit 1
end
@name = params[1]
if @name.nil?
show_usage
ui.fatal(keyname_missing_error)
exit 1
end
end
|
#keyname_missing_error ⇒ Object
52
53
54
|
# File 'lib/chef/knife/client_key_show.rb', line 52
def keyname_missing_error
"You must specify a key name"
end
|
#load_method ⇒ Object
44
45
46
|
# File 'lib/chef/knife/client_key_show.rb', line 44
def load_method
:load_by_client
end
|
#run ⇒ Object
39
40
41
42
|
# File 'lib/chef/knife/client_key_show.rb', line 39
def run
apply_params!(@name_args)
service_object.run
end
|
#service_object ⇒ Object
56
57
58
|
# File 'lib/chef/knife/client_key_show.rb', line 56
def service_object
@service_object ||= Chef::Knife::KeyShow.new(@name, @actor, load_method, ui)
end
|