Class: Chef::Knife::SceKeyDelete
Instance Method Summary
collapse
Methods included from SceBase
#connection, #connection_storage, #datacenter_id, included, #locate_config_value, #msg_pair
Instance Method Details
#run ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/chef/knife/sce_key_delete.rb', line 32
def run
$stdout.sync = true
validate!
@key = connection.keys.get(config[:name])
raise "Key #{config[:name]} does not exist." if @key.nil?
msg_pair("Name", @key.name.to_s)
msg_pair("Instances", @key.instance_ids.join(", ").to_s)
msg_pair("Default", (@key.default ? "Yes" : "No"))
puts "\n"
confirm("Do you really want to delete this key")
run!(@key)
ui.warn("Deleted key #{@key.name.to_s}")
end
|
#run!(key) ⇒ Object
28
29
30
|
# File 'lib/chef/knife/sce_key_delete.rb', line 28
def run!(key)
key.destroy
end
|
#validate! ⇒ Object
55
56
57
58
59
60
61
62
|
# File 'lib/chef/knife/sce_key_delete.rb', line 55
def validate!
super
raise "No key name specified." if @name_args.length == 0
config[:name] = @name_args[0]
end
|