Class: Chef::Knife::Ec2AmiList
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::Ec2AmiList
- Includes:
- Ec2Base
- Defined in:
- lib/chef/knife/ec2_ami_list.rb
Overview
Overview
This file provides the facility to display AMI list.
Owner
By default owner is aws-marketplace but you can specify following owner with the help of -o or --owner
- self => Displays the list of AMIs created by the user
- aws-marketplace => Displays all AMIs form trusted vendors like Ubuntu, Microsoft, SAP, Zend as well as many open source offering
- microsoft => Displays only Microsoft vendor AMIs
Platform
By default all platform AMI's will display but you can filter your response by specify the platform using -p or --platform
- Valid Platform => ubuntu, debian, centos, fedora, rhel, nginx, turnkey, jumpbox, coreos, cisco
Instance Method Summary collapse
Methods included from Ec2Base
#ami, #connection_string, #ec2_connection, #fetch_ami, #fetch_ec2_instance, #fetch_network_interfaces, #fetch_password_data, #fetch_region, #fetch_subnet, #find_name_tag, included, #is_image_windows?, #msg_pair, #normalize_server_data, #server_hashes, #validate_aws_config!, #vpc_mode?
Methods inherited from Chef::Knife
#aws_cred_file_location, #custom_warnings!, #find_server_platform, #iam_name_from_profile, #ini_parse
Instance Method Details
#run ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/chef/knife/ec2_ami_list.rb', line 60 def run $stdout.sync = true validate_aws_config! custom_warnings! servers_list = [ ui.color("AMI ID", :bold), ui.color("Platform", :bold), ui.color("Architecture", :bold), ui.color("Size", :bold), ui.color("Name", :bold), ui.color("Description", :bold), ].flatten.compact output_column_count = servers_list.length if config[:format] == "summary" ami_hashes.each_pair do |_k, v| servers_list << v["image_id"] servers_list << v["platform"] servers_list << v["architecture"] servers_list << v["size"] servers_list << v["name"] servers_list << v["description"] end puts ui.list(servers_list, :uneven_columns_across, output_column_count) else output(format_for_display(ami_hashes)) end end |