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.
- checksums.yaml +4 -4
- data/.expeditor/config.yml +13 -16
- data/.github/CODEOWNERS +4 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +14 -0
- data/.gitignore +0 -1
- data/.rspec +2 -0
- data/.rubocop.yml +30 -0
- data/.travis.yml +10 -17
- data/CHANGELOG.md +29 -7
- data/DOC_CHANGES.md +2 -12
- data/Gemfile +26 -2
- data/README.md +72 -75
- data/RELEASE_NOTES.md +10 -0
- data/Rakefile +25 -26
- data/VERSION +1 -1
- data/knife-ec2.gemspec +13 -20
- data/lib/chef/knife/ec2_ami_list.rb +31 -34
- data/lib/chef/knife/ec2_base.rb +137 -94
- data/lib/chef/knife/ec2_flavor_list.rb +12 -13
- data/lib/chef/knife/ec2_server_create.rb +440 -461
- data/lib/chef/knife/ec2_server_delete.rb +43 -41
- data/lib/chef/knife/ec2_server_list.rb +31 -28
- data/lib/chef/knife/s3_source.rb +22 -3
- data/lib/knife-ec2/version.rb +2 -2
- data/spec/spec_helper.rb +10 -11
- data/spec/unit/ec2_ami_list_spec.rb +297 -297
- data/spec/unit/ec2_flavor_list_spec.rb +18 -18
- data/spec/unit/ec2_server_create_spec.rb +952 -951
- data/spec/unit/ec2_server_delete_spec.rb +60 -61
- data/spec/unit/ec2_server_list_spec.rb +28 -28
- data/spec/unit/s3_source_deps_spec.rb +7 -7
- data/spec/unit/s3_source_spec.rb +17 -17
- metadata +26 -79
- data/CONTRIBUTING.md +0 -245
@@ -13,9 +13,8 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
#
|
15
15
|
|
16
|
-
require File.expand_path(
|
17
|
-
require
|
18
|
-
|
16
|
+
require File.expand_path("../../spec_helper", __FILE__)
|
17
|
+
require "fog/aws"
|
19
18
|
|
20
19
|
describe Chef::Knife::Ec2ServerDelete do
|
21
20
|
before do
|
@@ -24,38 +23,38 @@ describe Chef::Knife::Ec2ServerDelete do
|
|
24
23
|
describe "run" do
|
25
24
|
before(:each) do
|
26
25
|
{
|
27
|
-
:
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:
|
26
|
+
image: "image",
|
27
|
+
ssh_key_name: "ssh_key_name",
|
28
|
+
aws_access_key_id: "aws_access_key_id",
|
29
|
+
aws_secret_access_key: "aws_secret_access_key",
|
31
30
|
}.each do |key, value|
|
32
31
|
Chef::Config[:knife][key] = value
|
33
32
|
end
|
34
33
|
|
35
|
-
@ec2_server_attribs = { :
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
34
|
+
@ec2_server_attribs = { id: "i-39382318",
|
35
|
+
flavor_id: "m1.small",
|
36
|
+
image_id: "ami-47241231",
|
37
|
+
availability_zone: "us-west-1",
|
38
|
+
key_name: "my_ssh_key",
|
39
|
+
groups: %w{group1 group2},
|
40
|
+
security_group_ids: ["sg-00aa11bb"],
|
41
|
+
dns_name: "ec2-75.101.253.10.compute-1.amazonaws.com",
|
42
|
+
iam_instance_profile: {},
|
43
|
+
public_ip_address: "75.101.253.10",
|
44
|
+
private_dns_name: "ip-10-251-75-20.ec2.internal",
|
45
|
+
private_ip_address: "10.251.75.20",
|
46
|
+
root_device_type: "not_ebs",
|
47
|
+
tags: { "Name" => "foo" },
|
49
48
|
}
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
49
|
+
@knife_ec2_delete = Chef::Knife::Ec2ServerDelete.new
|
50
|
+
@ec2_servers = double()
|
51
|
+
allow(@knife_ec2_delete.ui).to receive(:confirm)
|
52
|
+
allow(@knife_ec2_delete).to receive(:msg_pair)
|
53
|
+
@ec2_server = double(@ec2_server_attribs)
|
54
|
+
@ec2_connection = double(Fog::Compute::AWS)
|
55
|
+
allow(@ec2_connection).to receive(:servers).and_return(@ec2_servers)
|
56
|
+
allow(@knife_ec2_delete.ui).to receive(:warn)
|
57
|
+
end
|
59
58
|
|
60
59
|
it "should invoke validate!" do
|
61
60
|
knife_ec2_delete = Chef::Knife::Ec2ServerDelete.new
|
@@ -64,49 +63,49 @@ describe Chef::Knife::Ec2ServerDelete do
|
|
64
63
|
end
|
65
64
|
|
66
65
|
it "should use invoke fog api to delete instance if instance id is passed" do
|
67
|
-
expect(@ec2_servers).to receive(:get).with(
|
66
|
+
expect(@ec2_servers).to receive(:get).with("foo").and_return(@ec2_server)
|
68
67
|
expect(Fog::Compute::AWS).to receive(:new).and_return(@ec2_connection)
|
69
|
-
@knife_ec2_delete.name_args = [
|
68
|
+
@knife_ec2_delete.name_args = ["foo"]
|
70
69
|
expect(@knife_ec2_delete).to receive(:validate!)
|
71
70
|
expect(@ec2_server).to receive(:destroy)
|
72
71
|
@knife_ec2_delete.run
|
73
72
|
end
|
74
73
|
|
75
74
|
it "should use node_name to figure out instance id if not specified explicitly" do
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
75
|
+
expect(@ec2_servers).to receive(:get).with("foo").and_return(@ec2_server)
|
76
|
+
expect(Fog::Compute::AWS).to receive(:new).and_return(@ec2_connection)
|
77
|
+
expect(@knife_ec2_delete).to receive(:validate!)
|
78
|
+
expect(@ec2_server).to receive(:destroy)
|
79
|
+
@knife_ec2_delete.config[:purge] = false
|
80
|
+
@knife_ec2_delete.config[:chef_node_name] = "baz"
|
81
|
+
double_node = double(Chef::Node)
|
82
|
+
expect(double_node).to receive(:attribute?).with("ec2").and_return(true)
|
83
|
+
expect(double_node).to receive(:[]).with("ec2").and_return("instance_id" => "foo")
|
84
|
+
double_search = double(Chef::Search::Query)
|
85
|
+
expect(double_search).to receive(:search).with(:node, "name:baz").and_return([[double_node], nil, nil])
|
86
|
+
expect(Chef::Search::Query).to receive(:new).and_return(double_search)
|
87
|
+
@knife_ec2_delete.name_args = []
|
88
|
+
@knife_ec2_delete.run
|
90
89
|
end
|
91
90
|
|
92
91
|
describe "when --purge is passed" do
|
93
92
|
it "should use the node name if its set" do
|
94
|
-
expect(@ec2_servers).to receive(:get).with(
|
93
|
+
expect(@ec2_servers).to receive(:get).with("foo").and_return(@ec2_server)
|
95
94
|
expect(Fog::Compute::AWS).to receive(:new).and_return(@ec2_connection)
|
96
|
-
@knife_ec2_delete.name_args = [
|
95
|
+
@knife_ec2_delete.name_args = ["foo"]
|
97
96
|
expect(@knife_ec2_delete).to receive(:validate!)
|
98
97
|
expect(@ec2_server).to receive(:destroy)
|
99
98
|
@knife_ec2_delete.config[:purge] = true
|
100
|
-
@knife_ec2_delete.config[:chef_node_name] =
|
101
|
-
expect(Chef::Node).to receive(:load).with(
|
102
|
-
expect(Chef::ApiClient).to receive(:load).with(
|
99
|
+
@knife_ec2_delete.config[:chef_node_name] = "baz"
|
100
|
+
expect(Chef::Node).to receive(:load).with("baz").and_return(double(destroy: true))
|
101
|
+
expect(Chef::ApiClient).to receive(:load).with("baz").and_return(double(destroy: true))
|
103
102
|
@knife_ec2_delete.run
|
104
103
|
end
|
105
104
|
|
106
105
|
it "should search for the node name using the instance id when node name is not specified" do
|
107
|
-
expect(@ec2_servers).to receive(:get).with(
|
106
|
+
expect(@ec2_servers).to receive(:get).with("i-foo").and_return(@ec2_server)
|
108
107
|
expect(Fog::Compute::AWS).to receive(:new).and_return(@ec2_connection)
|
109
|
-
@knife_ec2_delete.name_args = [
|
108
|
+
@knife_ec2_delete.name_args = ["i-foo"]
|
110
109
|
expect(@knife_ec2_delete).to receive(:validate!)
|
111
110
|
expect(@ec2_server).to receive(:destroy)
|
112
111
|
@knife_ec2_delete.config[:purge] = true
|
@@ -114,25 +113,25 @@ describe Chef::Knife::Ec2ServerDelete do
|
|
114
113
|
double_search = double(Chef::Search::Query)
|
115
114
|
double_node = double(Chef::Node)
|
116
115
|
expect(double_node).to receive(:name).and_return("baz")
|
117
|
-
expect(Chef::Node).to receive(:load).with(
|
118
|
-
expect(Chef::ApiClient).to receive(:load).with(
|
119
|
-
expect(double_search).to receive(:search).with(:node,"ec2_instance_id:i-foo").and_return([[double_node],nil,nil])
|
116
|
+
expect(Chef::Node).to receive(:load).with("baz").and_return(double(destroy: true))
|
117
|
+
expect(Chef::ApiClient).to receive(:load).with("baz").and_return(double(destroy: true))
|
118
|
+
expect(double_search).to receive(:search).with(:node, "ec2_instance_id:i-foo").and_return([[double_node], nil, nil])
|
120
119
|
expect(Chef::Search::Query).to receive(:new).and_return(double_search)
|
121
120
|
@knife_ec2_delete.run
|
122
121
|
end
|
123
122
|
|
124
123
|
it "should use the instance id if search does not return anything" do
|
125
|
-
expect(@ec2_servers).to receive(:get).with(
|
124
|
+
expect(@ec2_servers).to receive(:get).with("i-foo").and_return(@ec2_server)
|
126
125
|
expect(Fog::Compute::AWS).to receive(:new).and_return(@ec2_connection)
|
127
|
-
@knife_ec2_delete.name_args = [
|
126
|
+
@knife_ec2_delete.name_args = ["i-foo"]
|
128
127
|
expect(@knife_ec2_delete).to receive(:validate!)
|
129
128
|
expect(@ec2_server).to receive(:destroy)
|
130
129
|
@knife_ec2_delete.config[:purge] = true
|
131
130
|
@knife_ec2_delete.config[:chef_node_name] = nil
|
132
|
-
expect(Chef::Node).to receive(:load).with(
|
133
|
-
expect(Chef::ApiClient).to receive(:load).with(
|
131
|
+
expect(Chef::Node).to receive(:load).with("i-foo").and_return(double(destroy: true))
|
132
|
+
expect(Chef::ApiClient).to receive(:load).with("i-foo").and_return(double(destroy: true))
|
134
133
|
double_search = double(Chef::Search::Query)
|
135
|
-
expect(double_search).to receive(:search).with(:node,"ec2_instance_id:i-foo").and_return([[],nil,nil])
|
134
|
+
expect(double_search).to receive(:search).with(:node, "ec2_instance_id:i-foo").and_return([[], nil, nil])
|
136
135
|
expect(Chef::Search::Query).to receive(:new).and_return(double_search)
|
137
136
|
@knife_ec2_delete.run
|
138
137
|
end
|
@@ -13,19 +13,19 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
#
|
15
15
|
|
16
|
-
require File.expand_path(
|
17
|
-
require
|
16
|
+
require File.expand_path("../../spec_helper", __FILE__)
|
17
|
+
require "fog/aws"
|
18
18
|
|
19
19
|
describe Chef::Knife::Ec2ServerList do
|
20
20
|
|
21
|
-
describe
|
21
|
+
describe "#run" do
|
22
22
|
let(:knife_ec2_list) { Chef::Knife::Ec2ServerList.new }
|
23
23
|
let(:ec2_connection) { double(Fog::Compute::AWS) }
|
24
24
|
before do
|
25
25
|
allow(knife_ec2_list).to receive(:connection).and_return(ec2_connection)
|
26
26
|
end
|
27
27
|
|
28
|
-
it
|
28
|
+
it "invokes validate!" do
|
29
29
|
ec2_servers = double()
|
30
30
|
allow(ec2_connection).to receive(:servers).and_return(ec2_servers)
|
31
31
|
allow(knife_ec2_list.ui).to receive(:warn)
|
@@ -33,8 +33,8 @@ describe Chef::Knife::Ec2ServerList do
|
|
33
33
|
knife_ec2_list.run
|
34
34
|
end
|
35
35
|
|
36
|
-
context
|
37
|
-
it
|
36
|
+
context "when region is not specified" do
|
37
|
+
it "shows warning that default region will be will be used" do
|
38
38
|
knife_ec2_list.config.delete(:region)
|
39
39
|
Chef::Config[:knife].delete(:region)
|
40
40
|
ec2_servers = double()
|
@@ -45,31 +45,31 @@ describe Chef::Knife::Ec2ServerList do
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
-
context
|
49
|
-
context
|
48
|
+
context "--format option" do
|
49
|
+
context "when format=summary" do
|
50
50
|
before do
|
51
|
-
knife_ec2_list.config[:format] =
|
51
|
+
knife_ec2_list.config[:format] = "summary"
|
52
52
|
allow(knife_ec2_list.ui).to receive(:warn)
|
53
53
|
end
|
54
54
|
|
55
|
-
it
|
55
|
+
it "shows the output without Tags and Availability Zone in summary format" do
|
56
56
|
output_column = ["Instance ID", "Public IP", "Private IP", "Flavor",
|
57
57
|
"Image", "SSH Key", "Security Groups", "IAM Profile", "State"]
|
58
58
|
output_column_count = output_column.length
|
59
59
|
allow(ec2_connection).to receive(:servers).and_return([])
|
60
60
|
allow(knife_ec2_list).to receive(:validate!)
|
61
|
-
expect(knife_ec2_list.ui).to receive(:list).with(output_column
|
61
|
+
expect(knife_ec2_list.ui).to receive(:list).with(output_column, :uneven_columns_across, output_column_count)
|
62
62
|
knife_ec2_list.run
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
context
|
66
|
+
context "when format=json" do
|
67
67
|
before do
|
68
|
-
knife_ec2_list.config[:format] =
|
68
|
+
knife_ec2_list.config[:format] = "json"
|
69
69
|
allow(knife_ec2_list.ui).to receive(:warn)
|
70
70
|
end
|
71
71
|
|
72
|
-
it
|
72
|
+
it "shows the output without Tags and Availability Zone in summary format" do
|
73
73
|
allow(ec2_connection).to receive(:servers).and_return([])
|
74
74
|
allow(knife_ec2_list).to receive(:validate!)
|
75
75
|
allow(knife_ec2_list).to receive(:format_for_display)
|
@@ -79,51 +79,51 @@ describe Chef::Knife::Ec2ServerList do
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
-
context
|
82
|
+
context "when --tags option is passed" do
|
83
83
|
before do
|
84
|
-
knife_ec2_list.config[:format] =
|
84
|
+
knife_ec2_list.config[:format] = "summary"
|
85
85
|
allow(knife_ec2_list.ui).to receive(:warn)
|
86
86
|
allow(ec2_connection).to receive(:servers).and_return([])
|
87
87
|
allow(knife_ec2_list).to receive(:validate!)
|
88
88
|
end
|
89
89
|
|
90
|
-
context
|
91
|
-
it
|
92
|
-
knife_ec2_list.config[:tags] =
|
90
|
+
context "when single tag is passed" do
|
91
|
+
it "shows single tag field in the output" do
|
92
|
+
knife_ec2_list.config[:tags] = "tag1"
|
93
93
|
output_column = ["Instance ID", "Public IP", "Private IP", "Flavor",
|
94
94
|
"Image", "SSH Key", "Security Groups", "Tag:tag1", "IAM Profile", "State"]
|
95
95
|
output_column_count = output_column.length
|
96
|
-
expect(knife_ec2_list.ui).to receive(:list).with(output_column
|
96
|
+
expect(knife_ec2_list.ui).to receive(:list).with(output_column, :uneven_columns_across, output_column_count)
|
97
97
|
knife_ec2_list.run
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
|
-
context
|
102
|
-
it
|
103
|
-
knife_ec2_list.config[:tags] =
|
101
|
+
context "when multiple tags are passed" do
|
102
|
+
it "shows multiple tags fields in the output" do
|
103
|
+
knife_ec2_list.config[:tags] = "tag1,tag2"
|
104
104
|
output_column = ["Instance ID", "Public IP", "Private IP", "Flavor",
|
105
105
|
"Image", "SSH Key", "Security Groups", "Tag:tag1", "Tag:tag2", "IAM Profile", "State"]
|
106
106
|
output_column_count = output_column.length
|
107
|
-
expect(knife_ec2_list.ui).to receive(:list).with(output_column
|
107
|
+
expect(knife_ec2_list.ui).to receive(:list).with(output_column, :uneven_columns_across, output_column_count)
|
108
108
|
knife_ec2_list.run
|
109
109
|
end
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
-
context
|
113
|
+
context "when --availability-zone is passed" do
|
114
114
|
before do
|
115
|
-
knife_ec2_list.config[:format] =
|
115
|
+
knife_ec2_list.config[:format] = "summary"
|
116
116
|
allow(knife_ec2_list.ui).to receive(:warn)
|
117
117
|
allow(ec2_connection).to receive(:servers).and_return([])
|
118
118
|
allow(knife_ec2_list).to receive(:validate!)
|
119
119
|
end
|
120
120
|
|
121
|
-
it
|
121
|
+
it "shows the availability zones in the output" do
|
122
122
|
knife_ec2_list.config[:az] = true
|
123
123
|
output_column = ["Instance ID", "Public IP", "Private IP", "Flavor", "AZ",
|
124
124
|
"Image", "SSH Key", "Security Groups", "IAM Profile", "State"]
|
125
125
|
output_column_count = output_column.length
|
126
|
-
expect(knife_ec2_list.ui).to receive(:list).with(output_column
|
126
|
+
expect(knife_ec2_list.ui).to receive(:list).with(output_column, :uneven_columns_across, output_column_count)
|
127
127
|
knife_ec2_list.run
|
128
128
|
end
|
129
129
|
end
|
@@ -1,12 +1,12 @@
|
|
1
|
-
require File.expand_path(
|
1
|
+
require File.expand_path("../../spec_helper", __FILE__)
|
2
2
|
|
3
|
-
#This spec can only be run separately from the rest due to inclusion of fog library in other specs.
|
4
|
-
#rspec spec/unit/s3_source_deps_spec.rb
|
3
|
+
# This spec can only be run separately from the rest due to inclusion of fog library in other specs.
|
4
|
+
# rspec spec/unit/s3_source_deps_spec.rb
|
5
5
|
|
6
|
-
describe
|
6
|
+
describe "Check Dependencies", exclude: Object.constants.include?(:Fog) do
|
7
7
|
before(:each) do
|
8
8
|
end
|
9
|
-
it
|
9
|
+
it "should not load fog by default" do
|
10
10
|
begin
|
11
11
|
Fog::Storage::AWS.new()
|
12
12
|
rescue Exception => e
|
@@ -14,9 +14,9 @@ describe 'Check Dependencies', :exclude => Object.constants.include?(:Fog) do
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
it
|
17
|
+
it "lazy loads fog" do
|
18
18
|
begin
|
19
|
-
Chef::Knife::S3Source.fetch(
|
19
|
+
Chef::Knife::S3Source.fetch("test")
|
20
20
|
rescue Exception => e
|
21
21
|
expect(e).to be_a_kind_of(ArgumentError)
|
22
22
|
end
|
data/spec/unit/s3_source_spec.rb
CHANGED
@@ -1,27 +1,27 @@
|
|
1
|
-
require File.expand_path(
|
2
|
-
require
|
1
|
+
require File.expand_path("../../spec_helper", __FILE__)
|
2
|
+
require "fog/aws"
|
3
3
|
|
4
4
|
describe Chef::Knife::S3Source do
|
5
5
|
before(:each) do
|
6
|
-
@bucket_name =
|
7
|
-
@test_file_path =
|
6
|
+
@bucket_name = "mybucket"
|
7
|
+
@test_file_path = "path/file.pem"
|
8
8
|
@test_file_content = "TEST CONTENT\n"
|
9
9
|
|
10
10
|
Fog.mock!
|
11
11
|
|
12
12
|
{
|
13
|
-
aws_access_key_id:
|
14
|
-
aws_secret_access_key:
|
13
|
+
aws_access_key_id: "aws_access_key_id",
|
14
|
+
aws_secret_access_key: "aws_secret_access_key",
|
15
15
|
}.each do |key, value|
|
16
16
|
Chef::Config[:knife][key] = value
|
17
17
|
end
|
18
18
|
|
19
19
|
fog = Fog::Storage::AWS.new(
|
20
|
-
aws_access_key_id:
|
21
|
-
aws_secret_access_key:
|
20
|
+
aws_access_key_id: "aws_access_key_id",
|
21
|
+
aws_secret_access_key: "aws_secret_access_key"
|
22
22
|
)
|
23
|
-
test_dir_obj = fog.directories.create(
|
24
|
-
test_file_obj = test_dir_obj.files.create(
|
23
|
+
test_dir_obj = fog.directories.create("key" => @bucket_name)
|
24
|
+
test_file_obj = test_dir_obj.files.create("key" => @test_file_path)
|
25
25
|
test_file_obj.body = @test_file_content
|
26
26
|
test_file_obj.save
|
27
27
|
|
@@ -30,24 +30,24 @@ describe Chef::Knife::S3Source do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
context "for http URL format" do
|
33
|
-
it
|
33
|
+
it "converts URI to path with leading / removed" do
|
34
34
|
@s3_source.url = "http://s3.amazonaws.com/#{@bucket_name}/#{@test_file_path}"
|
35
35
|
@s3_source.instance_eval { path }
|
36
36
|
expect(@s3_source.instance_eval { path }).to eq(@test_file_path)
|
37
37
|
end
|
38
38
|
|
39
|
-
it
|
39
|
+
it "correctly retrieves the bucket name from the URI" do
|
40
40
|
@s3_source.url = "http://s3.amazonaws.com/#{@bucket_name}/#{@test_file_path}"
|
41
41
|
@s3_source.instance_eval { bucket }
|
42
42
|
expect(@s3_source.instance_eval { bucket }).to eq(@bucket_name)
|
43
43
|
end
|
44
44
|
|
45
|
-
it
|
45
|
+
it "gets back the correct bucket contents" do
|
46
46
|
@s3_source.url = "http://s3.amazonaws.com/#{@bucket_name}/#{@test_file_path}"
|
47
47
|
expect(@s3_source.body).to eq(@test_file_content)
|
48
48
|
end
|
49
49
|
|
50
|
-
it
|
50
|
+
it "gets back a bucket object with bucket_obj" do
|
51
51
|
@s3_source.url = "http://s3.amazonaws.com/#{@bucket_name}/#{@test_file_path}"
|
52
52
|
@s3_source.instance_eval { bucket_obj }
|
53
53
|
expect(@s3_source.instance_eval { bucket_obj }).to be_kind_of(Fog::Storage::AWS::Directory)
|
@@ -55,18 +55,18 @@ describe Chef::Knife::S3Source do
|
|
55
55
|
end
|
56
56
|
|
57
57
|
context "for s3 URL format" do
|
58
|
-
it
|
58
|
+
it "correctly retrieves the bucket name from the URI" do
|
59
59
|
@s3_source.url = "s3://#{@bucket_name}/#{@test_file_path}"
|
60
60
|
@s3_source.instance_eval { bucket }
|
61
61
|
expect(@s3_source.instance_eval { bucket }).to eq(@bucket_name)
|
62
62
|
end
|
63
63
|
|
64
|
-
it
|
64
|
+
it "gets back the correct bucket contents" do
|
65
65
|
@s3_source.url = "s3://#{@bucket_name}/#{@test_file_path}"
|
66
66
|
expect(@s3_source.body).to eq(@test_file_content)
|
67
67
|
end
|
68
68
|
|
69
|
-
it
|
69
|
+
it "gets back a bucket object with bucket_obj" do
|
70
70
|
@s3_source.url = "s3://#{@bucket_name}/#{@test_file_path}"
|
71
71
|
@s3_source.instance_eval { bucket_obj }
|
72
72
|
expect(@s3_source.instance_eval { bucket_obj }).to be_kind_of(Fog::Storage::AWS::Directory)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-ec2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.19.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
@@ -9,36 +9,28 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-08-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fog-aws
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - "~>"
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '1.0'
|
21
|
-
type: :runtime
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - "~>"
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: '1.0'
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: mime-types
|
30
16
|
requirement: !ruby/object:Gem::Requirement
|
31
17
|
requirements:
|
32
18
|
- - ">="
|
33
19
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
20
|
+
version: '1'
|
21
|
+
- - "<"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '4'
|
35
24
|
type: :runtime
|
36
25
|
prerelease: false
|
37
26
|
version_requirements: !ruby/object:Gem::Requirement
|
38
27
|
requirements:
|
39
28
|
- - ">="
|
40
29
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
30
|
+
version: '1'
|
31
|
+
- - "<"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '4'
|
42
34
|
- !ruby/object:Gem::Dependency
|
43
35
|
name: knife-windows
|
44
36
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,63 +45,7 @@ dependencies:
|
|
53
45
|
- - "~>"
|
54
46
|
- !ruby/object:Gem::Version
|
55
47
|
version: '1.0'
|
56
|
-
|
57
|
-
name: chef
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - ">="
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: 12.2.1
|
63
|
-
type: :development
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - ">="
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: 12.2.1
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: rspec
|
72
|
-
requirement: !ruby/object:Gem::Requirement
|
73
|
-
requirements:
|
74
|
-
- - "~>"
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
version: '3.0'
|
77
|
-
type: :development
|
78
|
-
prerelease: false
|
79
|
-
version_requirements: !ruby/object:Gem::Requirement
|
80
|
-
requirements:
|
81
|
-
- - "~>"
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
version: '3.0'
|
84
|
-
- !ruby/object:Gem::Dependency
|
85
|
-
name: rake
|
86
|
-
requirement: !ruby/object:Gem::Requirement
|
87
|
-
requirements:
|
88
|
-
- - ">="
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: '0'
|
91
|
-
type: :development
|
92
|
-
prerelease: false
|
93
|
-
version_requirements: !ruby/object:Gem::Requirement
|
94
|
-
requirements:
|
95
|
-
- - ">="
|
96
|
-
- !ruby/object:Gem::Version
|
97
|
-
version: '0'
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
name: sdoc
|
100
|
-
requirement: !ruby/object:Gem::Requirement
|
101
|
-
requirements:
|
102
|
-
- - "~>"
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version: '0.3'
|
105
|
-
type: :development
|
106
|
-
prerelease: false
|
107
|
-
version_requirements: !ruby/object:Gem::Requirement
|
108
|
-
requirements:
|
109
|
-
- - "~>"
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: '0.3'
|
112
|
-
description: EC2 Support for Chef's Knife Command
|
48
|
+
description: Amazon EC2 Support for Chef's Knife Command
|
113
49
|
email:
|
114
50
|
- adam@chef.io
|
115
51
|
- schisamo@chef.io
|
@@ -119,11 +55,14 @@ extra_rdoc_files: []
|
|
119
55
|
files:
|
120
56
|
- ".expeditor/config.yml"
|
121
57
|
- ".expeditor/update_version.sh"
|
58
|
+
- ".github/CODEOWNERS"
|
122
59
|
- ".github/ISSUE_TEMPLATE.md"
|
60
|
+
- ".github/PULL_REQUEST_TEMPLATE.md"
|
123
61
|
- ".gitignore"
|
62
|
+
- ".rspec"
|
63
|
+
- ".rubocop.yml"
|
124
64
|
- ".travis.yml"
|
125
65
|
- CHANGELOG.md
|
126
|
-
- CONTRIBUTING.md
|
127
66
|
- DOC_CHANGES.md
|
128
67
|
- Gemfile
|
129
68
|
- LICENSE
|
@@ -160,7 +99,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
160
99
|
requirements:
|
161
100
|
- - ">="
|
162
101
|
- !ruby/object:Gem::Version
|
163
|
-
version: 2.
|
102
|
+
version: '2.3'
|
164
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
104
|
requirements:
|
166
105
|
- - ">="
|
@@ -171,5 +110,13 @@ rubyforge_project:
|
|
171
110
|
rubygems_version: 2.7.6
|
172
111
|
signing_key:
|
173
112
|
specification_version: 4
|
174
|
-
summary: EC2 Support for Chef's Knife Command
|
175
|
-
test_files:
|
113
|
+
summary: Amazon EC2 Support for Chef's Knife Command
|
114
|
+
test_files:
|
115
|
+
- spec/spec_helper.rb
|
116
|
+
- spec/unit/ec2_ami_list_spec.rb
|
117
|
+
- spec/unit/ec2_flavor_list_spec.rb
|
118
|
+
- spec/unit/ec2_server_create_spec.rb
|
119
|
+
- spec/unit/ec2_server_delete_spec.rb
|
120
|
+
- spec/unit/ec2_server_list_spec.rb
|
121
|
+
- spec/unit/s3_source_deps_spec.rb
|
122
|
+
- spec/unit/s3_source_spec.rb
|