Class: Chef::Knife::ClientKeyEdit
Overview
Implements knife client key edit using Chef::Knife::KeyEdit as a service class.
Constant Summary
Constants inherited
from Chef::Knife
CHEF_ORGANIZATION_MANAGEMENT, KNIFE_ROOT, OFFICIAL_PLUGINS, OPSCODE_HOSTED_CHEF_ACCESS_CONTROL, VERSION
Instance Attribute Summary collapse
Attributes inherited from Chef::Knife
#name_args, #ui
Instance Method Summary
collapse
included
Methods inherited from Chef::Knife
#api_key, #apply_computed_config, category, chef_config_dir, common_name, #config_file_defaults, #config_file_settings, config_loader, #config_source, #configure_chef, #create_object, #delete_object, dependency_loaders, deps, #format_rest_error, guess_category, #humanize_exception, #humanize_http_exception, inherited, list_commands, load_commands, load_config, load_deps, #maybe_setup_fips, #merge_configs, msg, #noauth_rest, #parse_options, reset_config_loader!, reset_subcommands!, #rest, #root_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
Constructor Details
Returns a new instance of ClientKeyEdit.
41
42
43
44
|
# File 'lib/chef/knife/client_key_edit.rb', line 41
def initialize(argv = [])
super(argv)
@service_object = nil
end
|
Instance Attribute Details
#actor ⇒ String
the name of the client that this key is for
30
31
32
|
# File 'lib/chef/knife/client_key_edit.rb', line 30
def actor
@actor
end
|
Instance Method Details
#actor_field_name ⇒ Object
51
52
53
|
# File 'lib/chef/knife/client_key_edit.rb', line 51
def actor_field_name
"client"
end
|
#actor_missing_error ⇒ Object
59
60
61
|
# File 'lib/chef/knife/client_key_edit.rb', line 59
def actor_missing_error
"You must specify a client name"
end
|
#apply_params!(params) ⇒ Object
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/chef/knife/client_key_edit.rb', line 67
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
63
64
65
|
# File 'lib/chef/knife/client_key_edit.rb', line 63
def keyname_missing_error
"You must specify a key name"
end
|
#run ⇒ Object
46
47
48
49
|
# File 'lib/chef/knife/client_key_edit.rb', line 46
def run
apply_params!(@name_args)
service_object.run
end
|
#service_object ⇒ Object
55
56
57
|
# File 'lib/chef/knife/client_key_edit.rb', line 55
def service_object
@service_object ||= Chef::Knife::KeyEdit.new(@name, @actor, actor_field_name, ui, config)
end
|