Class: Chef::Knife::AzureImageList
Instance Method Summary
collapse
Methods included from AzureBase
#connection, #find_file, included, #is_image_windows?, #locate_config_value, #msg_pair, #msg_server_summary, #parse_publish_settings_file, #validate!
Instance Method Details
#h ⇒ Object
38
39
40
|
# File 'lib/chef/knife/azure_image_list.rb', line 38
def h
@highline ||= HighLine.new
end
|
#run ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/chef/knife/azure_image_list.rb', line 42
def run
$stdout.sync = true
validate!
image_labels = !locate_config_value(:show_all_fields) ? ['Name', 'OS', 'Location'] : ['Name', 'Category', 'Label', 'OS', 'Location']
image_list = image_labels.map {|label| ui.color(label, :bold)}
items = connection.images.all
image_items = image_labels.map {|item| item.downcase }
items.each do |image|
image_items.each {|item| image_list << image.send(item).to_s }
end
puts "\n"
puts h.list(image_list, :uneven_columns_across, !locate_config_value(:show_all_fields) ? 3 : 5)
end
|