Class: Chef::Knife::AzureImageList
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::AzureImageList
- Includes:
- AzureBase
- Defined in:
- lib/chef/knife/azure_image_list.rb
Instance Method Summary collapse
Methods included from AzureBase
#fetch_chef_client_logs, #fetch_deployment, #fetch_extension, #fetch_role, #fetch_substatus, #find_file, #get_azure_profile_file_path, #get_default_subscription, included, #is_image_windows?, #locate_config_value, #msg_pair, #msg_server_summary, #parse_azure_profile, #parse_publish_settings_file, #pretty_key, #service, #validate!, #validate_asm_keys!, #validate_params!
Instance Method Details
#run ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/chef/knife/azure_image_list.rb', line 38 def run $stdout.sync = true validate_asm_keys! items = service.list_images 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)} 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 ui.list(image_list, :uneven_columns_across, !locate_config_value(:show_all_fields) ? 3 : 5) end |