Class: Chef::Knife::SceKeyList
Instance Method Summary
collapse
Methods included from SceBase
#connection, #connection_storage, #datacenter_id, included, #locate_config_value, #msg_pair, #validate!
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
54
55
56
57
58
|
# File 'lib/chef/knife/sce_key_list.rb', line 32
def run
$stdout.sync = true
validate!
keys = run!
key_list = [
ui.color('Name', :bold),
ui.color('Default', :bold),
ui.color("Modified at", :bold),
ui.color('Instances', :bold)
].flatten.compact
output_column_count = key_list.length
keys.each do |k|
key_list << k.name.to_s
key_list << (k.default ? "*" : " ")
key_list << Time.at(k.modified_at/1000).to_datetime.to_s
key_list << k.instance_ids.join(", ").to_s
end
puts ui.list(key_list, :uneven_columns_across, output_column_count)
end
|
#run! ⇒ Object
28
29
30
|
# File 'lib/chef/knife/sce_key_list.rb', line 28
def run!
connection.keys.all
end
|