knife-ec2 0.12.0 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +41 -41
- data/.travis.yml +7 -1
- data/CHANGELOG.md +40 -4
- data/CONTRIBUTING.md +216 -71
- data/CONTRIBUTIONS.md +3 -6
- data/DOC_CHANGES.md +25 -50
- data/Gemfile +4 -1
- data/LICENSE +201 -201
- data/README.md +138 -83
- data/RELEASE_NOTES.md +20 -36
- data/Rakefile +56 -56
- data/knife-ec2.gemspec +4 -3
- data/lib/chef/knife/ec2_base.rb +45 -12
- data/lib/chef/knife/ec2_flavor_list.rb +53 -53
- data/lib/chef/knife/ec2_server_create.rb +251 -45
- data/lib/chef/knife/ec2_server_delete.rb +140 -140
- data/lib/chef/knife/ec2_server_list.rb +52 -83
- data/lib/chef/knife/s3_source.rb +49 -49
- data/lib/knife-ec2/version.rb +6 -6
- data/spec/spec_helper.rb +18 -18
- data/spec/unit/ec2_server_create_spec.rb +930 -19
- data/spec/unit/ec2_server_delete_spec.rb +141 -141
- data/spec/unit/ec2_server_list_spec.rb +131 -0
- data/spec/unit/s3_source_deps_spec.rb +24 -24
- data/spec/unit/s3_source_spec.rb +75 -75
- metadata +25 -15
data/spec/unit/s3_source_spec.rb
CHANGED
@@ -1,75 +1,75 @@
|
|
1
|
-
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
-
require 'fog'
|
3
|
-
|
4
|
-
describe Chef::Knife::S3Source do
|
5
|
-
before(:each) do
|
6
|
-
@bucket_name = 'mybucket'
|
7
|
-
@test_file_path = 'path/file.pem'
|
8
|
-
@test_file_content = "TEST CONTENT\n"
|
9
|
-
|
10
|
-
Fog.mock!
|
11
|
-
|
12
|
-
{
|
13
|
-
aws_access_key_id: 'aws_access_key_id',
|
14
|
-
aws_secret_access_key: 'aws_secret_access_key'
|
15
|
-
}.each do |key, value|
|
16
|
-
Chef::Config[:knife][key] = value
|
17
|
-
end
|
18
|
-
|
19
|
-
fog = Fog::Storage::AWS.new(
|
20
|
-
aws_access_key_id: 'aws_access_key_id',
|
21
|
-
aws_secret_access_key: 'aws_secret_access_key'
|
22
|
-
)
|
23
|
-
test_dir_obj = fog.directories.create('key' => @bucket_name)
|
24
|
-
test_file_obj = test_dir_obj.files.create('key' => @test_file_path)
|
25
|
-
test_file_obj.body = @test_file_content
|
26
|
-
test_file_obj.save
|
27
|
-
|
28
|
-
@s3_connection = double(Fog::Storage::AWS)
|
29
|
-
@s3_source = Chef::Knife::S3Source.new
|
30
|
-
end
|
31
|
-
|
32
|
-
context "for http URL format" do
|
33
|
-
it 'converts URI to path with leading / removed' do
|
34
|
-
@s3_source.url = "http://s3.amazonaws.com/#{@bucket_name}/#{@test_file_path}"
|
35
|
-
@s3_source.instance_eval { path }
|
36
|
-
expect(@s3_source.instance_eval { path }).to eq(@test_file_path)
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'correctly retrieves the bucket name from the URI' do
|
40
|
-
@s3_source.url = "http://s3.amazonaws.com/#{@bucket_name}/#{@test_file_path}"
|
41
|
-
@s3_source.instance_eval { bucket }
|
42
|
-
expect(@s3_source.instance_eval { bucket }).to eq(@bucket_name)
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'gets back the correct bucket contents' do
|
46
|
-
@s3_source.url = "http://s3.amazonaws.com/#{@bucket_name}/#{@test_file_path}"
|
47
|
-
expect(@s3_source.body).to eq(@test_file_content)
|
48
|
-
end
|
49
|
-
|
50
|
-
it 'gets back a bucket object with bucket_obj' do
|
51
|
-
@s3_source.url = "http://s3.amazonaws.com/#{@bucket_name}/#{@test_file_path}"
|
52
|
-
@s3_source.instance_eval { bucket_obj }
|
53
|
-
expect(@s3_source.instance_eval { bucket_obj }).to be_kind_of(Fog::Storage::AWS::Directory)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
context "for s3 URL format" do
|
58
|
-
it 'correctly retrieves the bucket name from the URI' do
|
59
|
-
@s3_source.url = "s3://#{@bucket_name}/#{@test_file_path}"
|
60
|
-
@s3_source.instance_eval { bucket }
|
61
|
-
expect(@s3_source.instance_eval { bucket }).to eq(@bucket_name)
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'gets back the correct bucket contents' do
|
65
|
-
@s3_source.url = "s3://#{@bucket_name}/#{@test_file_path}"
|
66
|
-
expect(@s3_source.body).to eq(@test_file_content)
|
67
|
-
end
|
68
|
-
|
69
|
-
it 'gets back a bucket object with bucket_obj' do
|
70
|
-
@s3_source.url = "s3://#{@bucket_name}/#{@test_file_path}"
|
71
|
-
@s3_source.instance_eval { bucket_obj }
|
72
|
-
expect(@s3_source.instance_eval { bucket_obj }).to be_kind_of(Fog::Storage::AWS::Directory)
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
require 'fog/aws'
|
3
|
+
|
4
|
+
describe Chef::Knife::S3Source do
|
5
|
+
before(:each) do
|
6
|
+
@bucket_name = 'mybucket'
|
7
|
+
@test_file_path = 'path/file.pem'
|
8
|
+
@test_file_content = "TEST CONTENT\n"
|
9
|
+
|
10
|
+
Fog.mock!
|
11
|
+
|
12
|
+
{
|
13
|
+
aws_access_key_id: 'aws_access_key_id',
|
14
|
+
aws_secret_access_key: 'aws_secret_access_key'
|
15
|
+
}.each do |key, value|
|
16
|
+
Chef::Config[:knife][key] = value
|
17
|
+
end
|
18
|
+
|
19
|
+
fog = Fog::Storage::AWS.new(
|
20
|
+
aws_access_key_id: 'aws_access_key_id',
|
21
|
+
aws_secret_access_key: 'aws_secret_access_key'
|
22
|
+
)
|
23
|
+
test_dir_obj = fog.directories.create('key' => @bucket_name)
|
24
|
+
test_file_obj = test_dir_obj.files.create('key' => @test_file_path)
|
25
|
+
test_file_obj.body = @test_file_content
|
26
|
+
test_file_obj.save
|
27
|
+
|
28
|
+
@s3_connection = double(Fog::Storage::AWS)
|
29
|
+
@s3_source = Chef::Knife::S3Source.new
|
30
|
+
end
|
31
|
+
|
32
|
+
context "for http URL format" do
|
33
|
+
it 'converts URI to path with leading / removed' do
|
34
|
+
@s3_source.url = "http://s3.amazonaws.com/#{@bucket_name}/#{@test_file_path}"
|
35
|
+
@s3_source.instance_eval { path }
|
36
|
+
expect(@s3_source.instance_eval { path }).to eq(@test_file_path)
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'correctly retrieves the bucket name from the URI' do
|
40
|
+
@s3_source.url = "http://s3.amazonaws.com/#{@bucket_name}/#{@test_file_path}"
|
41
|
+
@s3_source.instance_eval { bucket }
|
42
|
+
expect(@s3_source.instance_eval { bucket }).to eq(@bucket_name)
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'gets back the correct bucket contents' do
|
46
|
+
@s3_source.url = "http://s3.amazonaws.com/#{@bucket_name}/#{@test_file_path}"
|
47
|
+
expect(@s3_source.body).to eq(@test_file_content)
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'gets back a bucket object with bucket_obj' do
|
51
|
+
@s3_source.url = "http://s3.amazonaws.com/#{@bucket_name}/#{@test_file_path}"
|
52
|
+
@s3_source.instance_eval { bucket_obj }
|
53
|
+
expect(@s3_source.instance_eval { bucket_obj }).to be_kind_of(Fog::Storage::AWS::Directory)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
context "for s3 URL format" do
|
58
|
+
it 'correctly retrieves the bucket name from the URI' do
|
59
|
+
@s3_source.url = "s3://#{@bucket_name}/#{@test_file_path}"
|
60
|
+
@s3_source.instance_eval { bucket }
|
61
|
+
expect(@s3_source.instance_eval { bucket }).to eq(@bucket_name)
|
62
|
+
end
|
63
|
+
|
64
|
+
it 'gets back the correct bucket contents' do
|
65
|
+
@s3_source.url = "s3://#{@bucket_name}/#{@test_file_path}"
|
66
|
+
expect(@s3_source.body).to eq(@test_file_content)
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'gets back a bucket object with bucket_obj' do
|
70
|
+
@s3_source.url = "s3://#{@bucket_name}/#{@test_file_path}"
|
71
|
+
@s3_source.instance_eval { bucket_obj }
|
72
|
+
expect(@s3_source.instance_eval { bucket_obj }).to be_kind_of(Fog::Storage::AWS::Directory)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
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.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
@@ -9,22 +9,36 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-08-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name: fog
|
15
|
+
name: fog-aws
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: '0.7'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
27
|
+
version: '0.7'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: mime-types
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
28
42
|
- !ruby/object:Gem::Dependency
|
29
43
|
name: knife-windows
|
30
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -103,8 +117,8 @@ dependencies:
|
|
103
117
|
version: '0.3'
|
104
118
|
description: EC2 Support for Chef's Knife Command
|
105
119
|
email:
|
106
|
-
- adam@
|
107
|
-
- schisamo@
|
120
|
+
- adam@chef.io
|
121
|
+
- schisamo@chef.io
|
108
122
|
executables: []
|
109
123
|
extensions: []
|
110
124
|
extra_rdoc_files: []
|
@@ -131,9 +145,10 @@ files:
|
|
131
145
|
- spec/spec_helper.rb
|
132
146
|
- spec/unit/ec2_server_create_spec.rb
|
133
147
|
- spec/unit/ec2_server_delete_spec.rb
|
148
|
+
- spec/unit/ec2_server_list_spec.rb
|
134
149
|
- spec/unit/s3_source_deps_spec.rb
|
135
150
|
- spec/unit/s3_source_spec.rb
|
136
|
-
homepage: https://github.com/
|
151
|
+
homepage: https://github.com/chef/knife-ec2
|
137
152
|
licenses:
|
138
153
|
- Apache-2.0
|
139
154
|
metadata: {}
|
@@ -153,14 +168,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
153
168
|
version: '0'
|
154
169
|
requirements: []
|
155
170
|
rubyforge_project:
|
156
|
-
rubygems_version: 2.
|
171
|
+
rubygems_version: 2.5.1
|
157
172
|
signing_key:
|
158
173
|
specification_version: 4
|
159
174
|
summary: EC2 Support for Chef's Knife Command
|
160
|
-
test_files:
|
161
|
-
- spec/spec_helper.rb
|
162
|
-
- spec/unit/ec2_server_create_spec.rb
|
163
|
-
- spec/unit/ec2_server_delete_spec.rb
|
164
|
-
- spec/unit/s3_source_deps_spec.rb
|
165
|
-
- spec/unit/s3_source_spec.rb
|
175
|
+
test_files: []
|
166
176
|
has_rdoc:
|