knife-ec2 0.18.2 → 0.19.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Author:: Adam Jacob (<adam@chef.io>)
3
3
  # Author:: Seth Chisamore (<schisamo@chef.io>)
4
- # Copyright:: Copyright (c) 2009-2015 Chef Software, Inc.
4
+ # Copyright:: Copyright (c) 2009-2018 Chef Software, Inc.
5
5
  # License:: Apache License, Version 2.0
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,11 +17,7 @@
17
17
  # limitations under the License.
18
18
  #
19
19
 
20
- require 'chef/knife/ec2_base'
21
-
22
- # These two are needed for the '--purge' deletion case
23
- require 'chef/node'
24
- require 'chef/api_client'
20
+ require "chef/knife/ec2_base"
25
21
 
26
22
  class Chef
27
23
  class Knife
@@ -29,21 +25,27 @@ class Chef
29
25
 
30
26
  include Knife::Ec2Base
31
27
 
28
+ deps do
29
+ # These two are needed for the '--purge' deletion case
30
+ require "chef/node"
31
+ require "chef/api_client"
32
+ end
33
+
32
34
  banner "knife ec2 server delete SERVER [SERVER] (options)"
33
35
 
34
36
  attr_reader :server
35
37
 
36
38
  option :purge,
37
- :short => "-P",
38
- :long => "--purge",
39
- :boolean => true,
40
- :default => false,
41
- :description => "Destroy corresponding node and client on the Chef Server, in addition to destroying the EC2 node itself. Assumes node and client have the same name as the server (if not, add the '--node-name' option)."
39
+ short: "-P",
40
+ long: "--purge",
41
+ boolean: true,
42
+ default: false,
43
+ description: "Destroy corresponding node and client on the Chef Server, in addition to destroying the EC2 node itself. Assumes node and client have the same name as the server (if not, add the '--node-name' option)."
42
44
 
43
45
  option :chef_node_name,
44
- :short => "-N NAME",
45
- :long => "--node-name NAME",
46
- :description => "The name of the node and client to delete, if it differs from the server name. Only has meaning when used with the '--purge' option."
46
+ short: "-N NAME",
47
+ long: "--node-name NAME",
48
+ description: "The name of the node and client to delete, if it differs from the server name. Only has meaning when used with the '--purge' option."
47
49
 
48
50
  # Extracted from Chef::Knife.delete_object, because it has a
49
51
  # confirmation step built in... By specifying the '--purge'
@@ -51,17 +53,14 @@ class Chef
51
53
  # the user is already making their intent known. It is not
52
54
  # necessary to make them confirm two more times.
53
55
  def destroy_item(klass, name, type_name)
54
- begin
55
- object = klass.load(name)
56
- object.destroy
57
- ui.warn("Deleted #{type_name} #{name}")
58
- rescue Net::HTTPServerException
59
- ui.warn("Could not find a #{type_name} named #{name} to delete!")
60
- end
56
+ object = klass.load(name)
57
+ object.destroy
58
+ ui.warn("Deleted #{type_name} #{name}")
59
+ rescue Net::HTTPServerException
60
+ ui.warn("Could not find a #{type_name} named #{name} to delete!")
61
61
  end
62
62
 
63
63
  def run
64
-
65
64
  validate!
66
65
  if @name_args.empty? && config[:chef_node_name]
67
66
  ui.info("no instance id is specific, trying to retrieve it from node name")
@@ -74,23 +73,23 @@ class Chef
74
73
  begin
75
74
  @server = connection.servers.get(instance_id)
76
75
 
77
- msg_pair('Instance ID', @server.id)
78
- msg_pair('Instance Name', @server.tags['Name'])
79
- msg_pair('Flavor', @server.flavor_id)
80
- msg_pair('Image', @server.image_id)
81
- msg_pair('Region', connection.instance_variable_get(:@region))
82
- msg_pair('Availability Zone', @server.availability_zone)
83
- msg_pair('Security Groups', @server.groups.join(', '))
84
- msg_pair('IAM Profile', iam_name_from_profile(@server.iam_instance_profile)) if @server.iam_instance_profile
85
- msg_pair('SSH Key', @server.key_name)
86
- msg_pair('Root Device Type', @server.root_device_type)
87
- msg_pair('Public DNS Name', @server.dns_name)
88
- msg_pair('Public IP Address', @server.public_ip_address)
89
- msg_pair('Private DNS Name', @server.private_dns_name)
90
- msg_pair('Private IP Address', @server.private_ip_address)
76
+ msg_pair("Instance ID", @server.id)
77
+ msg_pair("Instance Name", @server.tags["Name"])
78
+ msg_pair("Flavor", @server.flavor_id)
79
+ msg_pair("Image", @server.image_id)
80
+ msg_pair("Region", connection.instance_variable_get(:@region))
81
+ msg_pair("Availability Zone", @server.availability_zone)
82
+ msg_pair("Security Groups", @server.groups.join(", "))
83
+ msg_pair("IAM Profile", iam_name_from_profile(@server.iam_instance_profile)) if @server.iam_instance_profile
84
+ msg_pair("SSH Key", @server.key_name)
85
+ msg_pair("Root Device Type", @server.root_device_type)
86
+ msg_pair("Public DNS Name", @server.dns_name)
87
+ msg_pair("Public IP Address", @server.public_ip_address)
88
+ msg_pair("Private DNS Name", @server.private_dns_name)
89
+ msg_pair("Private IP Address", @server.private_ip_address)
91
90
 
92
91
  puts '\n'
93
- confirm('Do you really want to delete this server')
92
+ confirm("Do you really want to delete this server")
94
93
 
95
94
  @server.destroy
96
95
 
@@ -113,8 +112,9 @@ class Chef
113
112
  end
114
113
  end
115
114
 
115
+ # @return [String]
116
116
  def fetch_node_name(instance_id)
117
- result = query.search(:node,"ec2_instance_id:#{instance_id}")
117
+ result = query.search(:node, "ec2_instance_id:#{instance_id}")
118
118
  unless result.first.empty?
119
119
  result.first.first.name
120
120
  else
@@ -122,16 +122,18 @@ class Chef
122
122
  end
123
123
  end
124
124
 
125
+ # @return [String]
125
126
  def fetch_instance_id(name)
126
- result = query.search(:node,"name:#{name}")
127
+ result = query.search(:node, "name:#{name}")
127
128
  unless result.first.empty?
128
129
  node = result.first.first
129
- if node.attribute?('ec2')
130
- node['ec2']['instance_id']
130
+ if node.attribute?("ec2")
131
+ node["ec2"]["instance_id"]
131
132
  end
132
133
  end
133
134
  end
134
135
 
136
+ # @return [Chef::Search::Query]
135
137
  def query
136
138
  @query ||= Chef::Search::Query.new
137
139
  end
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Author:: Adam Jacob (<adam@chef.io>)
3
3
  # Author:: Seth Chisamore (<schisamo@chef.io>)
4
- # Copyright:: Copyright (c) 2010-2015 Chef Software, Inc.
4
+ # Copyright:: Copyright (c) 2010-2018 Chef Software, Inc.
5
5
  # License:: Apache License, Version 2.0
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,7 +17,7 @@
17
17
  # limitations under the License.
18
18
  #
19
19
 
20
- require 'chef/knife/ec2_base'
20
+ require "chef/knife/ec2_base"
21
21
 
22
22
  class Chef
23
23
  class Knife
@@ -28,24 +28,25 @@ class Chef
28
28
  banner "knife ec2 server list (options)"
29
29
 
30
30
  option :name,
31
- :short => "-n",
32
- :long => "--no-name",
33
- :boolean => true,
34
- :default => true,
35
- :description => "Do not display name tag in output"
31
+ short: "-n",
32
+ long: "--no-name",
33
+ boolean: true,
34
+ default: true,
35
+ description: "Do not display name tag in output"
36
36
 
37
37
  option :az,
38
- :short => "-z",
39
- :long => "--availability-zone",
40
- :boolean => true,
41
- :default => false,
42
- :description => "Show availability zones"
38
+ short: "-z",
39
+ long: "--availability-zone",
40
+ boolean: true,
41
+ default: false,
42
+ description: "Show availability zones"
43
43
 
44
44
  option :tags,
45
- :short => "-t TAG1,TAG2",
46
- :long => "--tags TAG1,TAG2",
47
- :description => "List of tags to output"
45
+ short: "-t TAG1,TAG2",
46
+ long: "--tags TAG1,TAG2",
47
+ description: "List of tags to output"
48
48
 
49
+ # @return [Symbol]
49
50
  def azcolor(az)
50
51
  case az
51
52
  when /a$/
@@ -56,6 +57,8 @@ class Chef
56
57
  color = :red
57
58
  when /d$/
58
59
  color = :magenta
60
+ when /e$/
61
+ color = :yellow
59
62
  else
60
63
  color = :cyan
61
64
  end
@@ -67,23 +70,23 @@ class Chef
67
70
  validate!
68
71
 
69
72
  server_list = [
70
- ui.color('Instance ID', :bold),
73
+ ui.color("Instance ID", :bold),
71
74
 
72
75
  if config[:name]
73
76
  ui.color("Name", :bold)
74
77
  end,
75
78
 
76
- ui.color('Public IP', :bold),
77
- ui.color('Private IP', :bold),
78
- ui.color('Flavor', :bold),
79
+ ui.color("Public IP", :bold),
80
+ ui.color("Private IP", :bold),
81
+ ui.color("Flavor", :bold),
79
82
 
80
83
  if config[:az]
81
- ui.color('AZ', :bold)
84
+ ui.color("AZ", :bold)
82
85
  end,
83
86
 
84
- ui.color('Image', :bold),
85
- ui.color('SSH Key', :bold),
86
- ui.color('Security Groups', :bold),
87
+ ui.color("Image", :bold),
88
+ ui.color("SSH Key", :bold),
89
+ ui.color("Security Groups", :bold),
87
90
 
88
91
  if config[:tags]
89
92
  config[:tags].split(",").collect do |tag_name|
@@ -91,8 +94,8 @@ class Chef
91
94
  end
92
95
  end,
93
96
 
94
- ui.color('IAM Profile', :bold),
95
- ui.color('State', :bold)
97
+ ui.color("IAM Profile", :bold),
98
+ ui.color("State", :bold)
96
99
  ].flatten.compact
97
100
 
98
101
  output_column_count = server_list.length
@@ -102,7 +105,7 @@ class Chef
102
105
  end
103
106
 
104
107
  servers = connection.servers
105
- if (config[:format] == 'summary')
108
+ if config[:format] == "summary"
106
109
  servers.each do |server|
107
110
  server_list << server.id.to_s
108
111
 
@@ -136,9 +139,9 @@ class Chef
136
139
  server_list << begin
137
140
  state = server.state.to_s.downcase
138
141
  case state
139
- when 'shutting-down','terminated','stopping','stopped'
142
+ when "shutting-down", "terminated", "stopping", "stopped"
140
143
  ui.color(state, :red)
141
- when 'pending'
144
+ when "pending"
142
145
  ui.color(state, :yellow)
143
146
  else
144
147
  ui.color(state, :green)
@@ -1,3 +1,19 @@
1
+ #
2
+ # License:: Apache License, Version 2.0
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
1
17
  class Chef
2
18
  class Knife
3
19
  class S3Source
@@ -19,6 +35,7 @@ class Chef
19
35
  @bucket_obj ||= fog.directories.get(bucket)
20
36
  end
21
37
 
38
+ # @return [URI]
22
39
  def bucket
23
40
  uri = URI(@url)
24
41
  if uri.scheme == "s3"
@@ -28,17 +45,19 @@ class Chef
28
45
  end
29
46
  end
30
47
 
48
+ # @return [URI]
31
49
  def path
32
50
  uri = URI(@url)
33
51
  if uri.scheme == "s3"
34
- URI(@url).path.sub(/^\//, '')
52
+ URI(@url).path.sub(/^\//, "")
35
53
  else
36
- URI(@url).path.split(bucket).last.sub(/^\//, '')
54
+ URI(@url).path.split(bucket).last.sub(/^\//, "")
37
55
  end
38
56
  end
39
57
 
58
+ # @return [Fog::Storage::AWS]
40
59
  def fog
41
- require 'fog/aws' # lazy load the fog library to speed up the knife run
60
+ require "fog/aws" # lazy load the fog library to speed up the knife run
42
61
  @fog ||= Fog::Storage::AWS.new(
43
62
  aws_access_key_id: Chef::Config[:knife][:aws_access_key_id],
44
63
  aws_secret_access_key: Chef::Config[:knife][:aws_secret_access_key]
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Ec2
3
- VERSION = "0.18.2"
4
- MAJOR, MINOR, TINY = VERSION.split('.')
3
+ VERSION = "0.19.10".freeze
4
+ MAJOR, MINOR, TINY = VERSION.split(".")
5
5
  end
6
6
  end
@@ -1,20 +1,19 @@
1
- $:.unshift File.expand_path('../../lib', __FILE__)
2
- require 'chef'
3
- require 'chef/knife/winrm_base'
4
- require 'chef/knife/ec2_server_create'
5
- require 'chef/knife/ec2_server_delete'
6
- require 'chef/knife/ec2_server_list'
7
- require 'chef/knife/ec2_ami_list'
8
- require 'chef/knife/ec2_flavor_list'
1
+ $:.unshift File.expand_path("../../lib", __FILE__)
2
+ require "chef"
3
+ require "chef/knife/winrm_base"
4
+ require "chef/knife/ec2_server_create"
5
+ require "chef/knife/ec2_server_delete"
6
+ require "chef/knife/ec2_server_list"
7
+ require "chef/knife/ec2_ami_list"
8
+ require "chef/knife/ec2_flavor_list"
9
9
 
10
10
  # Clear config between each example
11
11
  # to avoid dependencies between examples
12
12
  RSpec.configure do |c|
13
13
  c.raise_errors_for_deprecations!
14
- c.filter_run_excluding :exclude => true
14
+ c.filter_run_excluding exclude: true
15
15
  c.before(:each) do
16
16
  Chef::Config.reset
17
- Chef::Config[:knife] ={}
17
+ Chef::Config[:knife] = {}
18
18
  end
19
19
  end
20
-
@@ -13,345 +13,345 @@
13
13
  # limitations under the License.
14
14
  #
15
15
 
16
- require File.expand_path('../../spec_helper', __FILE__)
17
- require 'fog/aws'
16
+ require File.expand_path("../../spec_helper", __FILE__)
17
+ require "fog/aws"
18
18
 
19
- describe Chef::Knife::Ec2AmiList do
19
+ describe Chef::Knife::Ec2AmiList do
20
20
 
21
- describe '#run' do
22
- let(:knife_ec2_ami_list) { Chef::Knife::Ec2AmiList.new }
23
- let(:ec2_connection) { double(Fog::Compute::AWS) }
24
- before (:each) do
25
- allow(knife_ec2_ami_list).to receive(:connection).and_return(ec2_connection)
26
- @describe_images_format = double("describe_image_output", :body => {
27
- 'imagesSet' => [{
28
- 'architecture' => "x86_64",
29
- 'blockDeviceMapping' => [{"deviceName"=>"/dev/sda1",
30
- "snapshotId"=>"snap-f7e645f4",
31
- "volumeSize"=>30,
32
- "deleteOnTermination"=>"true",
33
- "volumeType"=>"standard",
34
- "encrypted"=>"false"}],
35
- 'description' => "window winrm",
36
- 'hypervisor' => "xen",
37
- 'imageId' => "ami-4ace6d23",
38
- 'imageLocation' => "microsoft/Windows_Server-2008-R2-SP1-English-64Bit-WebMatrix_Hosting-2012.06.12",
39
- 'imageOwnerAlias' => "microsoft",
40
- 'name' => "Windows_Server-2008-R2-SP1-English-64Bit-Windows_Media_Services_4.1-2012.06.12",
41
- 'imageOwnerId' => "461346954234",
42
- 'imageState' => "available",
43
- 'imageType' => "machine",
44
- 'isPublic' => true,
45
- 'platform' => "windows",
46
- 'productCodes' => [],
47
- 'rootDeviceName' => "/dev/sda1",
48
- 'rootDeviceType' => "ebs",
49
- 'stateReason' => {},
50
- 'tagSet' => {},
51
- 'virtualizationType' => "hvm"
52
- }, {
53
- 'architecture' => "i386",
54
- 'blockDeviceMapping' => [{"deviceName"=>"/dev/sda1",
55
- "snapshotId"=>"snap-f7e645f4",
56
- "volumeSize"=>10,
57
- "deleteOnTermination"=>"true",
58
- "volumeType"=>"standard",
59
- "encrypted"=>"false"}],
60
- 'description' => "DC for Quan",
61
- 'hypervisor' => "xen",
62
- 'imageId' => "ami-4ace6d21",
63
- 'imageOwnerAlias' => "aws-marketplace",
64
- 'name' => "ubuntu i386",
65
- 'imageOwnerId' => "461346954235",
66
- 'imageState' => "available",
67
- 'imageType' => "machine",
68
- 'isPublic' => true,
69
- 'productCodes' => [],
70
- 'rootDeviceName' => "/dev/sda1",
71
- 'rootDeviceType' => "ebs",
72
- 'stateReason' => {},
73
- 'tagSet' => {},
74
- 'virtualizationType' => "hvm"
75
- }, {
76
- 'architecture' => "x86_64",
77
- 'blockDeviceMapping' => [{"deviceName"=>"/dev/sda1",
78
- "snapshotId"=>"snap-f7e645f4",
79
- "volumeSize"=>8,
80
- "deleteOnTermination"=>"true",
81
- "volumeType"=>"standard",
82
- "encrypted"=>"false"}],
83
- 'description' => "ubuntu 14.04",
84
- 'hypervisor' => "xen",
85
- 'imageId' => "ami-4ace6d29",
86
- 'imageOwnerAlias' => "aws-marketplace",
87
- 'name' => "fedora i64",
88
- 'imageOwnerId' => "461346954234",
89
- 'imageState' => "available",
90
- 'imageType' => "machine",
91
- 'isPublic' => true,
92
- 'productCodes' => [],
93
- 'rootDeviceName' => "/dev/sda1",
94
- 'rootDeviceType' => "ebs",
95
- 'stateReason' => {},
96
- 'tagSet' => {},
97
- 'virtualizationType' => "hvm"
98
- }],
99
- 'requestId' => "ba38c315-f1b4-4822-b336-6309bed6d50c"
100
- }
101
- )
102
- end
21
+ describe "#run" do
22
+ let(:knife_ec2_ami_list) { Chef::Knife::Ec2AmiList.new }
23
+ let(:ec2_connection) { double(Fog::Compute::AWS) }
24
+ before (:each) do
25
+ allow(knife_ec2_ami_list).to receive(:connection).and_return(ec2_connection)
26
+ @describe_images_format = double("describe_image_output", body: {
27
+ "imagesSet" => [{
28
+ "architecture" => "x86_64",
29
+ "blockDeviceMapping" => [{ "deviceName" => "/dev/sda1",
30
+ "snapshotId" => "snap-f7e645f4",
31
+ "volumeSize" => 30,
32
+ "deleteOnTermination" => "true",
33
+ "volumeType" => "standard",
34
+ "encrypted" => "false" }],
35
+ "description" => "window winrm",
36
+ "hypervisor" => "xen",
37
+ "imageId" => "ami-4ace6d23",
38
+ "imageLocation" => "microsoft/Windows_Server-2008-R2-SP1-English-64Bit-WebMatrix_Hosting-2012.06.12",
39
+ "imageOwnerAlias" => "microsoft",
40
+ "name" => "Windows_Server-2008-R2-SP1-English-64Bit-Windows_Media_Services_4.1-2012.06.12",
41
+ "imageOwnerId" => "461346954234",
42
+ "imageState" => "available",
43
+ "imageType" => "machine",
44
+ "isPublic" => true,
45
+ "platform" => "windows",
46
+ "productCodes" => [],
47
+ "rootDeviceName" => "/dev/sda1",
48
+ "rootDeviceType" => "ebs",
49
+ "stateReason" => {},
50
+ "tagSet" => {},
51
+ "virtualizationType" => "hvm",
52
+ }, {
53
+ "architecture" => "i386",
54
+ "blockDeviceMapping" => [{ "deviceName" => "/dev/sda1",
55
+ "snapshotId" => "snap-f7e645f4",
56
+ "volumeSize" => 10,
57
+ "deleteOnTermination" => "true",
58
+ "volumeType" => "standard",
59
+ "encrypted" => "false" }],
60
+ "description" => "DC for Quan",
61
+ "hypervisor" => "xen",
62
+ "imageId" => "ami-4ace6d21",
63
+ "imageOwnerAlias" => "aws-marketplace",
64
+ "name" => "ubuntu i386",
65
+ "imageOwnerId" => "461346954235",
66
+ "imageState" => "available",
67
+ "imageType" => "machine",
68
+ "isPublic" => true,
69
+ "productCodes" => [],
70
+ "rootDeviceName" => "/dev/sda1",
71
+ "rootDeviceType" => "ebs",
72
+ "stateReason" => {},
73
+ "tagSet" => {},
74
+ "virtualizationType" => "hvm",
75
+ }, {
76
+ "architecture" => "x86_64",
77
+ "blockDeviceMapping" => [{ "deviceName" => "/dev/sda1",
78
+ "snapshotId" => "snap-f7e645f4",
79
+ "volumeSize" => 8,
80
+ "deleteOnTermination" => "true",
81
+ "volumeType" => "standard",
82
+ "encrypted" => "false" }],
83
+ "description" => "ubuntu 14.04",
84
+ "hypervisor" => "xen",
85
+ "imageId" => "ami-4ace6d29",
86
+ "imageOwnerAlias" => "aws-marketplace",
87
+ "name" => "fedora i64",
88
+ "imageOwnerId" => "461346954234",
89
+ "imageState" => "available",
90
+ "imageType" => "machine",
91
+ "isPublic" => true,
92
+ "productCodes" => [],
93
+ "rootDeviceName" => "/dev/sda1",
94
+ "rootDeviceType" => "ebs",
95
+ "stateReason" => {},
96
+ "tagSet" => {},
97
+ "virtualizationType" => "hvm",
98
+ }],
99
+ "requestId" => "ba38c315-f1b4-4822-b336-6309bed6d50c",
100
+ }
101
+ )
102
+ end
103
103
 
104
- it 'invokes validate!' do
104
+ it "invokes validate!" do
105
+ allow(ec2_connection).to receive(:describe_images).and_return(@describe_images_format)
106
+ allow(knife_ec2_ami_list.ui).to receive(:warn)
107
+ expect(knife_ec2_ami_list).to receive(:validate!)
108
+ knife_ec2_ami_list.run
109
+ end
110
+
111
+ context "when region is not specified" do
112
+ it "shows warning that default region will be will be used" do
113
+ knife_ec2_ami_list.config.delete(:region)
114
+ Chef::Config[:knife].delete(:region)
115
+ ec2_servers = double()
105
116
  allow(ec2_connection).to receive(:describe_images).and_return(@describe_images_format)
106
- allow(knife_ec2_ami_list.ui).to receive(:warn)
107
- expect(knife_ec2_ami_list).to receive(:validate!)
117
+ allow(knife_ec2_ami_list).to receive(:validate!)
118
+ expect(knife_ec2_ami_list.ui).to receive(:warn).with("No region was specified in knife.rb or as an argument. The default region, us-east-1, will be used:")
108
119
  knife_ec2_ami_list.run
109
120
  end
121
+ end
110
122
 
111
- context 'when region is not specified' do
112
- it 'shows warning that default region will be will be used' do
113
- knife_ec2_ami_list.config.delete(:region)
114
- Chef::Config[:knife].delete(:region)
115
- ec2_servers = double()
116
- allow(ec2_connection).to receive(:describe_images).and_return(@describe_images_format)
117
- allow(knife_ec2_ami_list).to receive(:validate!)
118
- expect(knife_ec2_ami_list.ui).to receive(:warn).with("No region was specified in knife.rb or as an argument. The default region, us-east-1, will be used:")
119
- knife_ec2_ami_list.run
120
- end
123
+ context "when --owner is passed" do
124
+ before do
125
+ allow(knife_ec2_ami_list.ui).to receive(:warn)
126
+ allow(knife_ec2_ami_list).to receive(:custom_warnings!)
127
+ knife_ec2_ami_list.config[:use_iam_profile] = true
121
128
  end
122
129
 
123
- context 'when --owner is passed' do
124
- before do
125
- allow(knife_ec2_ami_list.ui).to receive(:warn)
126
- allow(knife_ec2_ami_list).to receive(:custom_warnings!)
127
- knife_ec2_ami_list.config[:use_iam_profile] = true
128
- end
129
-
130
- context 'When value for owner is nil' do
131
- it 'shows the available AMIs List' do
132
- knife_ec2_ami_list.config[:owner] = nil
133
- allow(ec2_connection).to receive(:describe_images).and_return(@describe_images_format)
134
- expect(knife_ec2_ami_list).to receive(:validate!)
135
- images = ec2_connection.describe_images.body['imagesSet']
136
- output_column = ["AMI ID", "Platform", "Architecture", "Size", "Name", "Description"]
137
- output_column_count = output_column.length
138
- images.each do |image|
139
- output_column << image["imageId"].to_s
140
- output_column << (image["platform"] ? image["platform"] : image["name"].split(/\W+/).first)
141
- output_column << image["architecture"].to_s
142
- output_column << image["blockDeviceMapping"].first["volumeSize"].to_s
143
- output_column << image["name"].split(/\W+/).first
144
- output_column << image["description"]
145
- end
146
- expect(knife_ec2_ami_list.ui).to receive(:list).with(output_column,:uneven_columns_across, output_column_count)
147
- knife_ec2_ami_list.run
130
+ context "When value for owner is nil" do
131
+ it "shows the available AMIs List" do
132
+ knife_ec2_ami_list.config[:owner] = nil
133
+ allow(ec2_connection).to receive(:describe_images).and_return(@describe_images_format)
134
+ expect(knife_ec2_ami_list).to receive(:validate!)
135
+ images = ec2_connection.describe_images.body["imagesSet"]
136
+ output_column = ["AMI ID", "Platform", "Architecture", "Size", "Name", "Description"]
137
+ output_column_count = output_column.length
138
+ images.each do |image|
139
+ output_column << image["imageId"].to_s
140
+ output_column << (image["platform"] ? image["platform"] : image["name"].split(/\W+/).first)
141
+ output_column << image["architecture"].to_s
142
+ output_column << image["blockDeviceMapping"].first["volumeSize"].to_s
143
+ output_column << image["name"].split(/\W+/).first
144
+ output_column << image["description"]
148
145
  end
146
+ expect(knife_ec2_ami_list.ui).to receive(:list).with(output_column, :uneven_columns_across, output_column_count)
147
+ knife_ec2_ami_list.run
149
148
  end
149
+ end
150
150
 
151
- context 'When value for owner is self' do
152
- it 'does not raise any error' do
153
- knife_ec2_ami_list.config[:owner] = 'self'
154
- allow(ec2_connection).to receive(:describe_images).and_return(@describe_images_format)
155
- expect{ knife_ec2_ami_list.validate! }.not_to raise_error
156
- end
151
+ context "When value for owner is self" do
152
+ it "does not raise any error" do
153
+ knife_ec2_ami_list.config[:owner] = "self"
154
+ allow(ec2_connection).to receive(:describe_images).and_return(@describe_images_format)
155
+ expect { knife_ec2_ami_list.validate! }.not_to raise_error
157
156
  end
157
+ end
158
158
 
159
- context 'When value for owner is microsoft' do
160
- it 'does not raise any error' do
161
- knife_ec2_ami_list.config[:owner] = 'microsoft'
162
- allow(ec2_connection).to receive(:describe_images).and_return(@describe_images_format)
163
- expect{ knife_ec2_ami_list.validate! }.not_to raise_error
164
- end
159
+ context "When value for owner is microsoft" do
160
+ it "does not raise any error" do
161
+ knife_ec2_ami_list.config[:owner] = "microsoft"
162
+ allow(ec2_connection).to receive(:describe_images).and_return(@describe_images_format)
163
+ expect { knife_ec2_ami_list.validate! }.not_to raise_error
165
164
  end
165
+ end
166
166
 
167
- context 'When value for owner is aws-marketplace' do
168
- it 'does not raise any error' do
169
- knife_ec2_ami_list.config[:owner] = 'aws-marketplace'
170
- allow(ec2_connection).to receive(:describe_images).and_return(@describe_images_format)
171
- expect{ knife_ec2_ami_list.validate! }.not_to raise_error
172
- end
167
+ context "When value for owner is aws-marketplace" do
168
+ it "does not raise any error" do
169
+ knife_ec2_ami_list.config[:owner] = "aws-marketplace"
170
+ allow(ec2_connection).to receive(:describe_images).and_return(@describe_images_format)
171
+ expect { knife_ec2_ami_list.validate! }.not_to raise_error
173
172
  end
173
+ end
174
174
 
175
- context 'When owner is invalid' do
176
- it 'raises error' do
177
- knife_ec2_ami_list.config[:owner] = 'xyz'
178
- knife_ec2_ami_list.config[:use_iam_profile] = true
179
- expect{ knife_ec2_ami_list.validate! }.to raise_error "Invalid owner: #{knife_ec2_ami_list.config[:owner]}. Allowed owners are self, aws-marketplace or microsoft."
180
- end
175
+ context "When owner is invalid" do
176
+ it "raises error" do
177
+ knife_ec2_ami_list.config[:owner] = "xyz"
178
+ knife_ec2_ami_list.config[:use_iam_profile] = true
179
+ expect { knife_ec2_ami_list.validate! }.to raise_error "Invalid owner: #{knife_ec2_ami_list.config[:owner]}. Allowed owners are self, aws-marketplace or microsoft."
181
180
  end
182
181
  end
182
+ end
183
183
 
184
- context 'when --platform is passed' do
185
- before do
186
- allow(knife_ec2_ami_list.ui).to receive(:warn)
187
- allow(knife_ec2_ami_list).to receive(:custom_warnings!)
188
- end
184
+ context "when --platform is passed" do
185
+ before do
186
+ allow(knife_ec2_ami_list.ui).to receive(:warn)
187
+ allow(knife_ec2_ami_list).to receive(:custom_warnings!)
188
+ end
189
189
 
190
- context 'When platform is nil' do
191
- it 'shows all the AMIs List' do
192
- knife_ec2_ami_list.config[:platform] = nil
193
- allow(ec2_connection).to receive(:describe_images).and_return(@describe_images_format)
194
- images = ec2_connection.describe_images.body['imagesSet']
195
- expect(knife_ec2_ami_list).to receive(:validate!)
196
- output_column = ["AMI ID", "Platform", "Architecture", "Size", "Name", "Description"]
197
- output_column_count = output_column.length
198
- images.each do |image|
199
- output_column << image["imageId"].to_s
200
- output_column << (image["platform"] ? image["platform"] : image["name"].split(/\W+/).first)
201
- output_column << image["architecture"].to_s
202
- output_column << image["blockDeviceMapping"].first["volumeSize"].to_s
203
- output_column << image["name"].split(/\W+/).first
204
- output_column << image["description"]
205
- end
206
- expect(knife_ec2_ami_list.ui).to receive(:list).with(output_column,:uneven_columns_across, output_column_count)
207
- knife_ec2_ami_list.run
190
+ context "When platform is nil" do
191
+ it "shows all the AMIs List" do
192
+ knife_ec2_ami_list.config[:platform] = nil
193
+ allow(ec2_connection).to receive(:describe_images).and_return(@describe_images_format)
194
+ images = ec2_connection.describe_images.body["imagesSet"]
195
+ expect(knife_ec2_ami_list).to receive(:validate!)
196
+ output_column = ["AMI ID", "Platform", "Architecture", "Size", "Name", "Description"]
197
+ output_column_count = output_column.length
198
+ images.each do |image|
199
+ output_column << image["imageId"].to_s
200
+ output_column << (image["platform"] ? image["platform"] : image["name"].split(/\W+/).first)
201
+ output_column << image["architecture"].to_s
202
+ output_column << image["blockDeviceMapping"].first["volumeSize"].to_s
203
+ output_column << image["name"].split(/\W+/).first
204
+ output_column << image["description"]
208
205
  end
206
+ expect(knife_ec2_ami_list.ui).to receive(:list).with(output_column, :uneven_columns_across, output_column_count)
207
+ knife_ec2_ami_list.run
209
208
  end
209
+ end
210
210
 
211
- context 'When platform is windows' do
212
- it 'shows only windows AMIs List' do
213
- knife_ec2_ami_list.config[:platform] = 'windows'
214
- allow(ec2_connection).to receive(:describe_images).and_return(@describe_images_format)
215
- window_image = ec2_connection.describe_images.body['imagesSet'].first
216
- expect(knife_ec2_ami_list).to receive(:validate!)
217
- output_column = ["AMI ID", "Platform", "Architecture", "Size", "Name", "Description"]
218
- output_column_count = output_column.length
219
- output_column << window_image["imageId"]
220
- output_column << window_image["platform"]
221
- output_column << window_image["architecture"]
222
- output_column << window_image["blockDeviceMapping"].first["volumeSize"].to_s
223
- output_column << window_image["name"].split(/\W+/).first
224
- output_column << window_image["description"]
225
- expect(knife_ec2_ami_list.ui).to receive(:list).with(output_column,:uneven_columns_across, output_column_count)
226
- knife_ec2_ami_list.run
227
- end
211
+ context "When platform is windows" do
212
+ it "shows only windows AMIs List" do
213
+ knife_ec2_ami_list.config[:platform] = "windows"
214
+ allow(ec2_connection).to receive(:describe_images).and_return(@describe_images_format)
215
+ window_image = ec2_connection.describe_images.body["imagesSet"].first
216
+ expect(knife_ec2_ami_list).to receive(:validate!)
217
+ output_column = ["AMI ID", "Platform", "Architecture", "Size", "Name", "Description"]
218
+ output_column_count = output_column.length
219
+ output_column << window_image["imageId"]
220
+ output_column << window_image["platform"]
221
+ output_column << window_image["architecture"]
222
+ output_column << window_image["blockDeviceMapping"].first["volumeSize"].to_s
223
+ output_column << window_image["name"].split(/\W+/).first
224
+ output_column << window_image["description"]
225
+ expect(knife_ec2_ami_list.ui).to receive(:list).with(output_column, :uneven_columns_across, output_column_count)
226
+ knife_ec2_ami_list.run
228
227
  end
228
+ end
229
229
 
230
- context 'When platform is ubuntu' do
231
- it 'shows only ubuntu AMIs List' do
232
- knife_ec2_ami_list.config[:platform] = 'ubuntu'
233
- allow(ec2_connection).to receive(:describe_images).and_return(@describe_images_format)
234
- ubuntu_image = ec2_connection.describe_images.body['imagesSet'][1]
235
- expect(knife_ec2_ami_list).to receive(:validate!)
236
- output_column = ["AMI ID", "Platform", "Architecture", "Size", "Name", "Description"]
237
- output_column_count = output_column.length
238
- output_column << ubuntu_image["imageId"]
239
- output_column << ubuntu_image["name"].split(/\W+/).first
240
- output_column << ubuntu_image["architecture"]
241
- output_column << ubuntu_image["blockDeviceMapping"].first["volumeSize"].to_s
242
- output_column << ubuntu_image["name"].split(/\W+/).first
243
- output_column << ubuntu_image["description"]
244
- expect(knife_ec2_ami_list.ui).to receive(:list).with(output_column,:uneven_columns_across, output_column_count)
245
- knife_ec2_ami_list.run
246
- end
230
+ context "When platform is ubuntu" do
231
+ it "shows only ubuntu AMIs List" do
232
+ knife_ec2_ami_list.config[:platform] = "ubuntu"
233
+ allow(ec2_connection).to receive(:describe_images).and_return(@describe_images_format)
234
+ ubuntu_image = ec2_connection.describe_images.body["imagesSet"][1]
235
+ expect(knife_ec2_ami_list).to receive(:validate!)
236
+ output_column = ["AMI ID", "Platform", "Architecture", "Size", "Name", "Description"]
237
+ output_column_count = output_column.length
238
+ output_column << ubuntu_image["imageId"]
239
+ output_column << ubuntu_image["name"].split(/\W+/).first
240
+ output_column << ubuntu_image["architecture"]
241
+ output_column << ubuntu_image["blockDeviceMapping"].first["volumeSize"].to_s
242
+ output_column << ubuntu_image["name"].split(/\W+/).first
243
+ output_column << ubuntu_image["description"]
244
+ expect(knife_ec2_ami_list.ui).to receive(:list).with(output_column, :uneven_columns_across, output_column_count)
245
+ knife_ec2_ami_list.run
247
246
  end
247
+ end
248
248
 
249
- context 'When platform is fedora' do
250
- it 'shows only fedora AMIs List' do
251
- knife_ec2_ami_list.config[:platform] = 'fedora'
252
- allow(ec2_connection).to receive(:describe_images).and_return(@describe_images_format)
253
- expect(knife_ec2_ami_list).to receive(:validate!)
254
- fedora_image = ec2_connection.describe_images.body['imagesSet'].last
255
- output_column = ["AMI ID", "Platform", "Architecture", "Size", "Name", "Description"]
256
- output_column_count = output_column.length
257
- output_column << fedora_image["imageId"]
258
- output_column << fedora_image["name"].split(/\W+/).first
259
- output_column << fedora_image["architecture"]
260
- output_column << fedora_image["blockDeviceMapping"].first["volumeSize"].to_s
261
- output_column << fedora_image["name"].split(/\W+/).first
262
- output_column << fedora_image["description"]
263
- expect(knife_ec2_ami_list.ui).to receive(:list).with(output_column,:uneven_columns_across, output_column_count)
264
- knife_ec2_ami_list.run
265
- end
249
+ context "When platform is fedora" do
250
+ it "shows only fedora AMIs List" do
251
+ knife_ec2_ami_list.config[:platform] = "fedora"
252
+ allow(ec2_connection).to receive(:describe_images).and_return(@describe_images_format)
253
+ expect(knife_ec2_ami_list).to receive(:validate!)
254
+ fedora_image = ec2_connection.describe_images.body["imagesSet"].last
255
+ output_column = ["AMI ID", "Platform", "Architecture", "Size", "Name", "Description"]
256
+ output_column_count = output_column.length
257
+ output_column << fedora_image["imageId"]
258
+ output_column << fedora_image["name"].split(/\W+/).first
259
+ output_column << fedora_image["architecture"]
260
+ output_column << fedora_image["blockDeviceMapping"].first["volumeSize"].to_s
261
+ output_column << fedora_image["name"].split(/\W+/).first
262
+ output_column << fedora_image["description"]
263
+ expect(knife_ec2_ami_list.ui).to receive(:list).with(output_column, :uneven_columns_across, output_column_count)
264
+ knife_ec2_ami_list.run
266
265
  end
266
+ end
267
267
 
268
- context 'When platform is invalid' do
269
- it 'raises error' do
270
- knife_ec2_ami_list.config[:platform] = 'xyz'
271
- knife_ec2_ami_list.config[:use_iam_profile] = true
272
- knife_ec2_ami_list.config[:owner] = true
273
- expect{ knife_ec2_ami_list.validate! }.to raise_error "Invalid platform: #{knife_ec2_ami_list.config[:platform]}. Allowed platforms are: windows, ubuntu, debian, centos, fedora, rhel, nginx, turnkey, jumpbox, coreos, cisco, amazon, nessus."
274
- end
268
+ context "When platform is invalid" do
269
+ it "raises error" do
270
+ knife_ec2_ami_list.config[:platform] = "xyz"
271
+ knife_ec2_ami_list.config[:use_iam_profile] = true
272
+ knife_ec2_ami_list.config[:owner] = true
273
+ expect { knife_ec2_ami_list.validate! }.to raise_error "Invalid platform: #{knife_ec2_ami_list.config[:platform]}. Allowed platforms are: windows, ubuntu, debian, centos, fedora, rhel, nginx, turnkey, jumpbox, coreos, cisco, amazon, nessus."
275
274
  end
276
275
  end
276
+ end
277
277
 
278
- context 'when --search is passed' do
279
- before do
280
- allow(knife_ec2_ami_list.ui).to receive(:warn)
281
- allow(knife_ec2_ami_list).to receive(:custom_warnings!)
282
- end
278
+ context "when --search is passed" do
279
+ before do
280
+ allow(knife_ec2_ami_list.ui).to receive(:warn)
281
+ allow(knife_ec2_ami_list).to receive(:custom_warnings!)
282
+ end
283
283
 
284
- context 'When search key word is present in description' do
285
- it 'shows only AMIs List that have 14.04 in description' do
286
- knife_ec2_ami_list.config[:search] = '14.04'
287
- allow(ec2_connection).to receive(:describe_images).and_return(@describe_images_format)
288
- image = ec2_connection.describe_images.body['imagesSet'][2]
289
- expect(knife_ec2_ami_list).to receive(:validate!)
290
- output_column = ["AMI ID", "Platform", "Architecture", "Size", "Name", "Description"]
291
- output_column_count = output_column.length
292
- output_column << image["imageId"]
293
- output_column << image["name"].split(/\W+/).first
294
- output_column << image["architecture"]
295
- output_column << image["blockDeviceMapping"].first["volumeSize"].to_s
296
- output_column << image["name"].split(/\W+/).first
297
- output_column << image["description"]
298
- expect(knife_ec2_ami_list.ui).to receive(:list).with(output_column,:uneven_columns_across, output_column_count)
299
- knife_ec2_ami_list.run
300
- end
284
+ context "When search key word is present in description" do
285
+ it "shows only AMIs List that have 14.04 in description" do
286
+ knife_ec2_ami_list.config[:search] = "14.04"
287
+ allow(ec2_connection).to receive(:describe_images).and_return(@describe_images_format)
288
+ image = ec2_connection.describe_images.body["imagesSet"][2]
289
+ expect(knife_ec2_ami_list).to receive(:validate!)
290
+ output_column = ["AMI ID", "Platform", "Architecture", "Size", "Name", "Description"]
291
+ output_column_count = output_column.length
292
+ output_column << image["imageId"]
293
+ output_column << image["name"].split(/\W+/).first
294
+ output_column << image["architecture"]
295
+ output_column << image["blockDeviceMapping"].first["volumeSize"].to_s
296
+ output_column << image["name"].split(/\W+/).first
297
+ output_column << image["description"]
298
+ expect(knife_ec2_ami_list.ui).to receive(:list).with(output_column, :uneven_columns_across, output_column_count)
299
+ knife_ec2_ami_list.run
301
300
  end
301
+ end
302
302
 
303
- context 'When user pass platform and search keyword' do
304
- it 'shows only AMIs List that have 14.04 in description and platform is ubuntu' do
305
- knife_ec2_ami_list.config[:platform] = 'ubuntu'
306
- knife_ec2_ami_list.config[:search] = 'Quan'
307
- allow(ec2_connection).to receive(:describe_images).and_return(@describe_images_format)
308
- ubuntu_image = ec2_connection.describe_images.body['imagesSet'][1]
309
- expect(knife_ec2_ami_list).to receive(:validate!)
310
- output_column = ["AMI ID", "Platform", "Architecture", "Size", "Name", "Description"]
311
- output_column_count = output_column.length
312
- output_column << ubuntu_image["imageId"]
313
- output_column << ubuntu_image["name"].split(/\W+/).first
314
- output_column << ubuntu_image["architecture"]
315
- output_column << ubuntu_image["blockDeviceMapping"].first["volumeSize"].to_s
316
- output_column << ubuntu_image["name"].split(/\W+/).first
317
- output_column << ubuntu_image["description"]
318
- expect(knife_ec2_ami_list.ui).to receive(:list).with(output_column,:uneven_columns_across, output_column_count)
319
- knife_ec2_ami_list.run
320
- end
303
+ context "When user pass platform and search keyword" do
304
+ it "shows only AMIs List that have 14.04 in description and platform is ubuntu" do
305
+ knife_ec2_ami_list.config[:platform] = "ubuntu"
306
+ knife_ec2_ami_list.config[:search] = "Quan"
307
+ allow(ec2_connection).to receive(:describe_images).and_return(@describe_images_format)
308
+ ubuntu_image = ec2_connection.describe_images.body["imagesSet"][1]
309
+ expect(knife_ec2_ami_list).to receive(:validate!)
310
+ output_column = ["AMI ID", "Platform", "Architecture", "Size", "Name", "Description"]
311
+ output_column_count = output_column.length
312
+ output_column << ubuntu_image["imageId"]
313
+ output_column << ubuntu_image["name"].split(/\W+/).first
314
+ output_column << ubuntu_image["architecture"]
315
+ output_column << ubuntu_image["blockDeviceMapping"].first["volumeSize"].to_s
316
+ output_column << ubuntu_image["name"].split(/\W+/).first
317
+ output_column << ubuntu_image["description"]
318
+ expect(knife_ec2_ami_list.ui).to receive(:list).with(output_column, :uneven_columns_across, output_column_count)
319
+ knife_ec2_ami_list.run
321
320
  end
321
+ end
322
322
 
323
- context 'When user pass owner, platform and search keyword' do
324
- it 'shows only AMIs List that owner microsoft platform windows and search keyword is winrm' do
325
- knife_ec2_ami_list.config[:owner] = 'microsoft'
326
- knife_ec2_ami_list.config[:platform] = 'windows'
327
- knife_ec2_ami_list.config[:search] = 'winrm'
328
- allow(ec2_connection).to receive(:describe_images).and_return(@describe_images_format)
329
- ubuntu_image = ec2_connection.describe_images.body['imagesSet'].first
330
- expect(knife_ec2_ami_list).to receive(:validate!)
331
- output_column = ["AMI ID", "Platform", "Architecture", "Size", "Name", "Description"]
332
- output_column_count = output_column.length
333
- output_column << ubuntu_image["imageId"]
334
- output_column << ubuntu_image["platform"]
335
- output_column << ubuntu_image["architecture"]
336
- output_column << ubuntu_image["blockDeviceMapping"].first["volumeSize"].to_s
337
- output_column << ubuntu_image["name"].split(/\W+/).first
338
- output_column << ubuntu_image["description"]
339
- expect(knife_ec2_ami_list.ui).to receive(:list).with(output_column,:uneven_columns_across, output_column_count)
340
- knife_ec2_ami_list.run
341
- end
323
+ context "When user pass owner, platform and search keyword" do
324
+ it "shows only AMIs List that owner microsoft platform windows and search keyword is winrm" do
325
+ knife_ec2_ami_list.config[:owner] = "microsoft"
326
+ knife_ec2_ami_list.config[:platform] = "windows"
327
+ knife_ec2_ami_list.config[:search] = "winrm"
328
+ allow(ec2_connection).to receive(:describe_images).and_return(@describe_images_format)
329
+ ubuntu_image = ec2_connection.describe_images.body["imagesSet"].first
330
+ expect(knife_ec2_ami_list).to receive(:validate!)
331
+ output_column = ["AMI ID", "Platform", "Architecture", "Size", "Name", "Description"]
332
+ output_column_count = output_column.length
333
+ output_column << ubuntu_image["imageId"]
334
+ output_column << ubuntu_image["platform"]
335
+ output_column << ubuntu_image["architecture"]
336
+ output_column << ubuntu_image["blockDeviceMapping"].first["volumeSize"].to_s
337
+ output_column << ubuntu_image["name"].split(/\W+/).first
338
+ output_column << ubuntu_image["description"]
339
+ expect(knife_ec2_ami_list.ui).to receive(:list).with(output_column, :uneven_columns_across, output_column_count)
340
+ knife_ec2_ami_list.run
342
341
  end
342
+ end
343
343
 
344
- context 'When search key word is not present in description' do
345
- it 'Fetch no AMI' do
346
- knife_ec2_ami_list.config[:search] = 'Not present'
347
- allow(ec2_connection).to receive(:describe_images).and_return(@describe_images_format)
348
- expect(knife_ec2_ami_list).to receive(:validate!)
349
- output_column = ["AMI ID", "Platform", "Architecture", "Size", "Name", "Description"]
350
- output_column_count = output_column.length
351
- expect(knife_ec2_ami_list.ui).to receive(:list).with(output_column,:uneven_columns_across, output_column_count)
352
- knife_ec2_ami_list.run
353
- end
344
+ context "When search key word is not present in description" do
345
+ it "Fetch no AMI" do
346
+ knife_ec2_ami_list.config[:search] = "Not present"
347
+ allow(ec2_connection).to receive(:describe_images).and_return(@describe_images_format)
348
+ expect(knife_ec2_ami_list).to receive(:validate!)
349
+ output_column = ["AMI ID", "Platform", "Architecture", "Size", "Name", "Description"]
350
+ output_column_count = output_column.length
351
+ expect(knife_ec2_ami_list.ui).to receive(:list).with(output_column, :uneven_columns_across, output_column_count)
352
+ knife_ec2_ami_list.run
354
353
  end
355
354
  end
356
355
  end
357
356
  end
357
+ end