kitchen-ec2 2.2.2 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/kitchen/driver/ec2.rb +6 -2
- data/lib/kitchen/driver/ec2_version.rb +1 -1
- metadata +4 -24
- data/.gitignore +0 -22
- data/.rspec +0 -3
- data/.travis.yml +0 -21
- data/.yardopts +0 -3
- data/Gemfile +0 -16
- data/README.md +0 -497
- data/Rakefile +0 -43
- data/kitchen-ec2.gemspec +0 -40
- data/spec/kitchen/driver/ec2/client_spec.rb +0 -66
- data/spec/kitchen/driver/ec2/image_selection_spec.rb +0 -371
- data/spec/kitchen/driver/ec2/instance_generator_spec.rb +0 -612
- data/spec/kitchen/driver/ec2_spec.rb +0 -797
- data/spec/spec_helper.rb +0 -107
- data/spec/support/fake_image.rb +0 -36
data/Rakefile
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
require "bundler/gem_tasks"
|
4
|
-
|
5
|
-
require "rspec/core/rake_task"
|
6
|
-
RSpec::Core::RakeTask.new(:test)
|
7
|
-
|
8
|
-
desc "Display LOC stats"
|
9
|
-
task :stats do
|
10
|
-
puts "\n## Production Code Stats"
|
11
|
-
sh "countloc -r lib/kitchen lib/kitchen.rb"
|
12
|
-
puts "\n## Test Code Stats"
|
13
|
-
sh "countloc -r spec features"
|
14
|
-
end
|
15
|
-
|
16
|
-
require "chefstyle"
|
17
|
-
require "rubocop/rake_task"
|
18
|
-
RuboCop::RakeTask.new(:style) do |task|
|
19
|
-
task.options << "--display-cop-names"
|
20
|
-
end
|
21
|
-
|
22
|
-
desc "Run all quality tasks"
|
23
|
-
task :quality => [:style, :stats]
|
24
|
-
|
25
|
-
require "yard"
|
26
|
-
YARD::Rake::YardocTask.new
|
27
|
-
|
28
|
-
begin
|
29
|
-
task :default => [:test, :quality]
|
30
|
-
|
31
|
-
require "github_changelog_generator/task"
|
32
|
-
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
33
|
-
config.future_release = Kitchen::Driver::EC2_VERSION
|
34
|
-
config.enhancement_labels = "enhancement,Enhancement,New Feature,Feature".split(",")
|
35
|
-
config.bug_labels = "bug,Bug,Improvement".split(",")
|
36
|
-
config.exclude_labels = "duplicate,question,invalid,wontfix,no_changelog," \
|
37
|
-
",Exclude From Changelog,Question,Upstream Bug,Discussion".split(",")
|
38
|
-
end
|
39
|
-
rescue LoadError
|
40
|
-
task :changelog do
|
41
|
-
raise "github_changelog_generator not installed! gem install github_changelog_generator."
|
42
|
-
end
|
43
|
-
end
|
data/kitchen-ec2.gemspec
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
lib = File.expand_path("../lib", __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require "kitchen/driver/ec2_version.rb"
|
5
|
-
|
6
|
-
Gem::Specification.new do |gem|
|
7
|
-
gem.name = "kitchen-ec2"
|
8
|
-
gem.version = Kitchen::Driver::EC2_VERSION
|
9
|
-
gem.license = "Apache 2.0"
|
10
|
-
gem.authors = ["Fletcher Nichol"]
|
11
|
-
gem.email = ["fnichol@nichol.ca"]
|
12
|
-
gem.description = "A Test Kitchen Driver for Amazon EC2"
|
13
|
-
gem.summary = gem.description
|
14
|
-
gem.homepage = "https://kitchen.ci/"
|
15
|
-
|
16
|
-
gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
17
|
-
gem.executables = []
|
18
|
-
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
|
-
gem.require_paths = ["lib"]
|
20
|
-
|
21
|
-
gem.required_ruby_version = ">= 2.2.2"
|
22
|
-
|
23
|
-
gem.add_dependency "test-kitchen", "~> 1.4", ">= 1.4.1"
|
24
|
-
gem.add_dependency "excon"
|
25
|
-
gem.add_dependency "multi_json"
|
26
|
-
gem.add_dependency "aws-sdk", "~> 2"
|
27
|
-
gem.add_dependency "retryable", "~> 2.0"
|
28
|
-
|
29
|
-
gem.add_development_dependency "rspec", "~> 3.2"
|
30
|
-
gem.add_development_dependency "countloc", "~> 0.4"
|
31
|
-
gem.add_development_dependency "maruku", "~> 0.6"
|
32
|
-
gem.add_development_dependency "simplecov", "~> 0.7"
|
33
|
-
gem.add_development_dependency "yard", "~> 0.9", ">= 0.9.11"
|
34
|
-
|
35
|
-
# style and complexity libraries are tightly version pinned as newer releases
|
36
|
-
# may introduce new and undesireable style choices which would be immediately
|
37
|
-
# enforced in CI
|
38
|
-
gem.add_development_dependency "chefstyle", "= 0.6.0"
|
39
|
-
gem.add_development_dependency "climate_control"
|
40
|
-
end
|
@@ -1,66 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
#
|
3
|
-
# Author:: Tyler Ball (<tball@chef.io>)
|
4
|
-
#
|
5
|
-
# Copyright:: 2015-2018, Fletcher Nichol
|
6
|
-
# Copyright:: 2016-2018, Chef Software, Inc.
|
7
|
-
#
|
8
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
-
# you may not use this file except in compliance with the License.
|
10
|
-
# You may obtain a copy of the License at
|
11
|
-
#
|
12
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
-
#
|
14
|
-
# Unless required by applicable law or agreed to in writing, software
|
15
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
-
# See the License for the specific language governing permissions and
|
18
|
-
# limitations under the License.
|
19
|
-
|
20
|
-
require "kitchen/driver/aws/client"
|
21
|
-
require "climate_control"
|
22
|
-
|
23
|
-
describe Kitchen::Driver::Aws::Client do
|
24
|
-
|
25
|
-
let(:client) { Kitchen::Driver::Aws::Client.new("us-west-1") }
|
26
|
-
|
27
|
-
describe "#initialize" do
|
28
|
-
|
29
|
-
it "successfully creates a client" do
|
30
|
-
expect(client).to be_a(Kitchen::Driver::Aws::Client)
|
31
|
-
end
|
32
|
-
|
33
|
-
it "Sets the AWS config" do
|
34
|
-
client
|
35
|
-
expect(Aws.config[:region]).to eq("us-west-1")
|
36
|
-
end
|
37
|
-
|
38
|
-
context "when provided all optional parameters" do
|
39
|
-
let(:client) do
|
40
|
-
Kitchen::Driver::Aws::Client.new(
|
41
|
-
"us-west-1",
|
42
|
-
"test-profile",
|
43
|
-
"http_proxy",
|
44
|
-
999,
|
45
|
-
false
|
46
|
-
)
|
47
|
-
end
|
48
|
-
it "Sets the AWS config" do
|
49
|
-
client
|
50
|
-
expect(Aws.config[:region]).to eq("us-west-1")
|
51
|
-
expect(Aws.config[:profile]).to eq("test-profile")
|
52
|
-
expect(Aws.config[:http_proxy]).to eq("http_proxy")
|
53
|
-
expect(Aws.config[:retry_limit]).to eq(999)
|
54
|
-
expect(Aws.config[:ssl_verify_peer]).to eq(false)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
it "returns a client" do
|
60
|
-
expect(client.client).to be_a(Aws::EC2::Client)
|
61
|
-
end
|
62
|
-
|
63
|
-
it "returns a resource" do
|
64
|
-
expect(client.resource).to be_a(Aws::EC2::Resource)
|
65
|
-
end
|
66
|
-
end
|
@@ -1,371 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Copyright:: 2015-2018, Fletcher Nichol
|
3
|
-
# Copyright:: 2016-2018, Chef Software, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
require "kitchen/driver/ec2"
|
18
|
-
require "kitchen/provisioner/dummy"
|
19
|
-
require "kitchen/transport/dummy"
|
20
|
-
require "kitchen/verifier/dummy"
|
21
|
-
|
22
|
-
describe "Default images for various platforms" do
|
23
|
-
let(:driver) do
|
24
|
-
Kitchen::Driver::Ec2.new(:region => "us-west-2", :aws_ssh_key_id => "foo", **config)
|
25
|
-
end
|
26
|
-
let(:config) { {} }
|
27
|
-
def new_instance(platform_name: "blarghle")
|
28
|
-
Kitchen::Instance.new(
|
29
|
-
:driver => driver,
|
30
|
-
:suite => Kitchen::Suite.new(:name => "suite-name"),
|
31
|
-
:platform => Kitchen::Platform.new(:name => platform_name),
|
32
|
-
:provisioner => Kitchen::Provisioner::Dummy.new,
|
33
|
-
:transport => Kitchen::Transport::Dummy.new,
|
34
|
-
:verifier => Kitchen::Verifier::Dummy.new,
|
35
|
-
:state_file => Kitchen::StateFile.new("/nonexistent", "suite-name-#{platform_name}")
|
36
|
-
)
|
37
|
-
end
|
38
|
-
|
39
|
-
PLATFORM_SEARCHES = {
|
40
|
-
"amazon" => [
|
41
|
-
{ :name => "owner-id", :values => %w{137112412989} },
|
42
|
-
{ :name => "name", :values => %w{amzn-ami-*} },
|
43
|
-
],
|
44
|
-
"amazon-x86_64" => [
|
45
|
-
{ :name => "owner-id", :values => %w{137112412989} },
|
46
|
-
{ :name => "name", :values => %w{amzn-ami-*} },
|
47
|
-
{ :name => "architecture", :values => ["x86_64"] },
|
48
|
-
],
|
49
|
-
"amazon-2016" => [
|
50
|
-
{ :name => "owner-id", :values => %w{137112412989} },
|
51
|
-
{ :name => "name", :values => %w{amzn-ami-*-2016*} },
|
52
|
-
],
|
53
|
-
"amazon-2017" => [
|
54
|
-
{ :name => "owner-id", :values => %w{137112412989} },
|
55
|
-
{ :name => "name", :values => %w{amzn-ami-*-2017*} },
|
56
|
-
],
|
57
|
-
"amazon-2016.09" => [
|
58
|
-
{ :name => "owner-id", :values => %w{137112412989} },
|
59
|
-
{ :name => "name", :values => %w{amzn-ami-*-2016.09*} },
|
60
|
-
],
|
61
|
-
"amazon-2017.03" => [
|
62
|
-
{ :name => "owner-id", :values => %w{137112412989} },
|
63
|
-
{ :name => "name", :values => %w{amzn-ami-*-2017.03*} },
|
64
|
-
],
|
65
|
-
"amazon-2017.03-x86_64" => [
|
66
|
-
{ :name => "owner-id", :values => %w{137112412989} },
|
67
|
-
{ :name => "name", :values => %w{amzn-ami-*-2017.03*} },
|
68
|
-
{ :name => "architecture", :values => ["x86_64"] },
|
69
|
-
],
|
70
|
-
|
71
|
-
"centos" => [
|
72
|
-
{ :name => "owner-alias", :values => %w{aws-marketplace} },
|
73
|
-
{ :name => "name", :values => ["CentOS Linux *", "CentOS-*-GA-*"] },
|
74
|
-
],
|
75
|
-
"centos-7" => [
|
76
|
-
{ :name => "owner-alias", :values => %w{aws-marketplace} },
|
77
|
-
{ :name => "name", :values => ["CentOS Linux 7*", "CentOS-7*-GA-*"] },
|
78
|
-
],
|
79
|
-
"centos-6" => [
|
80
|
-
{ :name => "owner-alias", :values => %w{aws-marketplace} },
|
81
|
-
{ :name => "name", :values => ["CentOS Linux 6*", "CentOS-6*-GA-*"] },
|
82
|
-
],
|
83
|
-
"centos-6.3" => [
|
84
|
-
{ :name => "owner-alias", :values => %w{aws-marketplace} },
|
85
|
-
{ :name => "name", :values => ["CentOS Linux 6.3*", "CentOS-6.3*-GA-*"] },
|
86
|
-
],
|
87
|
-
"centos-x86_64" => [
|
88
|
-
{ :name => "owner-alias", :values => %w{aws-marketplace} },
|
89
|
-
{ :name => "name", :values => ["CentOS Linux *", "CentOS-*-GA-*"] },
|
90
|
-
{ :name => "architecture", :values => %w{x86_64} },
|
91
|
-
],
|
92
|
-
"centos-6.3-x86_64" => [
|
93
|
-
{ :name => "owner-alias", :values => %w{aws-marketplace} },
|
94
|
-
{ :name => "name", :values => ["CentOS Linux 6.3*", "CentOS-6.3*-GA-*"] },
|
95
|
-
{ :name => "architecture", :values => %w{x86_64} },
|
96
|
-
],
|
97
|
-
"centos-7-x86_64" => [
|
98
|
-
{ :name => "owner-alias", :values => %w{aws-marketplace} },
|
99
|
-
{ :name => "name", :values => ["CentOS Linux 7*", "CentOS-7*-GA-*"] },
|
100
|
-
{ :name => "architecture", :values => %w{x86_64} },
|
101
|
-
],
|
102
|
-
|
103
|
-
"debian" => [
|
104
|
-
{ :name => "owner-id", :values => %w{379101102735} },
|
105
|
-
{ :name => "name", :values => %w{debian-stretch-*} },
|
106
|
-
],
|
107
|
-
"debian-9" => [
|
108
|
-
{ :name => "owner-id", :values => %w{379101102735} },
|
109
|
-
{ :name => "name", :values => %w{debian-stretch-*} },
|
110
|
-
],
|
111
|
-
"debian-8" => [
|
112
|
-
{ :name => "owner-id", :values => %w{379101102735} },
|
113
|
-
{ :name => "name", :values => %w{debian-jessie-*} },
|
114
|
-
],
|
115
|
-
"debian-7" => [
|
116
|
-
{ :name => "owner-id", :values => %w{379101102735} },
|
117
|
-
{ :name => "name", :values => %w{debian-wheezy-*} },
|
118
|
-
],
|
119
|
-
"debian-6" => [
|
120
|
-
{ :name => "owner-id", :values => %w{379101102735} },
|
121
|
-
{ :name => "name", :values => %w{debian-squeeze-*} },
|
122
|
-
],
|
123
|
-
"debian-x86_64" => [
|
124
|
-
{ :name => "owner-id", :values => %w{379101102735} },
|
125
|
-
{ :name => "name", :values => %w{debian-stretch-*} },
|
126
|
-
{ :name => "architecture", :values => %w{x86_64} },
|
127
|
-
],
|
128
|
-
"debian-6-x86_64" => [
|
129
|
-
{ :name => "owner-id", :values => %w{379101102735} },
|
130
|
-
{ :name => "name", :values => %w{debian-squeeze-*} },
|
131
|
-
{ :name => "architecture", :values => %w{x86_64} },
|
132
|
-
],
|
133
|
-
|
134
|
-
"rhel" => [
|
135
|
-
{ :name => "owner-id", :values => %w{309956199498} },
|
136
|
-
{ :name => "name", :values => %w{RHEL-*} },
|
137
|
-
],
|
138
|
-
"rhel-6" => [
|
139
|
-
{ :name => "owner-id", :values => %w{309956199498} },
|
140
|
-
{ :name => "name", :values => %w{RHEL-6*} },
|
141
|
-
],
|
142
|
-
"rhel-7.1" => [
|
143
|
-
{ :name => "owner-id", :values => %w{309956199498} },
|
144
|
-
{ :name => "name", :values => %w{RHEL-7.1*} },
|
145
|
-
],
|
146
|
-
"rhel-x86_64" => [
|
147
|
-
{ :name => "owner-id", :values => %w{309956199498} },
|
148
|
-
{ :name => "name", :values => %w{RHEL-*} },
|
149
|
-
{ :name => "architecture", :values => %w{x86_64} },
|
150
|
-
],
|
151
|
-
"rhel-6-x86_64" => [
|
152
|
-
{ :name => "owner-id", :values => %w{309956199498} },
|
153
|
-
{ :name => "name", :values => %w{RHEL-6*} },
|
154
|
-
{ :name => "architecture", :values => %w{x86_64} },
|
155
|
-
],
|
156
|
-
"el" => [
|
157
|
-
{ :name => "owner-id", :values => %w{309956199498} },
|
158
|
-
{ :name => "name", :values => %w{RHEL-*} },
|
159
|
-
],
|
160
|
-
"el-6-x86_64" => [
|
161
|
-
{ :name => "owner-id", :values => %w{309956199498} },
|
162
|
-
{ :name => "name", :values => %w{RHEL-6*} },
|
163
|
-
{ :name => "architecture", :values => %w{x86_64} },
|
164
|
-
],
|
165
|
-
|
166
|
-
"fedora" => [
|
167
|
-
{ :name => "owner-id", :values => %w{125523088429} },
|
168
|
-
{ :name => "name", :values => %w{Fedora-Cloud-Base-*} },
|
169
|
-
],
|
170
|
-
"fedora-22" => [
|
171
|
-
{ :name => "owner-id", :values => %w{125523088429} },
|
172
|
-
{ :name => "name", :values => %w{Fedora-Cloud-Base-22-*} },
|
173
|
-
],
|
174
|
-
"fedora-x86_64" => [
|
175
|
-
{ :name => "owner-id", :values => %w{125523088429} },
|
176
|
-
{ :name => "name", :values => %w{Fedora-Cloud-Base-*} },
|
177
|
-
{ :name => "architecture", :values => %w{x86_64} },
|
178
|
-
],
|
179
|
-
"fedora-22-x86_64" => [
|
180
|
-
{ :name => "owner-id", :values => %w{125523088429} },
|
181
|
-
{ :name => "name", :values => %w{Fedora-Cloud-Base-22-*} },
|
182
|
-
{ :name => "architecture", :values => %w{x86_64} },
|
183
|
-
],
|
184
|
-
|
185
|
-
"freebsd" => [
|
186
|
-
{ :name => "owner-id", :values => %w{118940168514} },
|
187
|
-
{ :name => "name", :values => ["FreeBSD *-RELEASE*", "FreeBSD/EC2 *-RELEASE*"] },
|
188
|
-
],
|
189
|
-
"freebsd-10" => [
|
190
|
-
{ :name => "owner-id", :values => %w{118940168514} },
|
191
|
-
{ :name => "name", :values => ["FreeBSD 10*-RELEASE*", "FreeBSD/EC2 10*-RELEASE*"] },
|
192
|
-
],
|
193
|
-
"freebsd-10.1" => [
|
194
|
-
{ :name => "owner-id", :values => %w{118940168514} },
|
195
|
-
{ :name => "name", :values => ["FreeBSD 10.1*-RELEASE*", "FreeBSD/EC2 10.1*-RELEASE*"] },
|
196
|
-
],
|
197
|
-
"freebsd-x86_64" => [
|
198
|
-
{ :name => "owner-id", :values => %w{118940168514} },
|
199
|
-
{ :name => "name", :values => ["FreeBSD *-RELEASE*", "FreeBSD/EC2 *-RELEASE*"] },
|
200
|
-
{ :name => "architecture", :values => %w{x86_64} },
|
201
|
-
],
|
202
|
-
"freebsd-10-x86_64" => [
|
203
|
-
{ :name => "owner-id", :values => %w{118940168514} },
|
204
|
-
{ :name => "name", :values => ["FreeBSD 10*-RELEASE*", "FreeBSD/EC2 10*-RELEASE*"] },
|
205
|
-
{ :name => "architecture", :values => %w{x86_64} },
|
206
|
-
],
|
207
|
-
|
208
|
-
"ubuntu" => [
|
209
|
-
{ :name => "owner-id", :values => %w{099720109477} },
|
210
|
-
{ :name => "name", :values => %w{ubuntu/images/*/ubuntu-*-*} },
|
211
|
-
],
|
212
|
-
"ubuntu-14" => [
|
213
|
-
{ :name => "owner-id", :values => %w{099720109477} },
|
214
|
-
{ :name => "name", :values => %w{ubuntu/images/*/ubuntu-*-14*} },
|
215
|
-
],
|
216
|
-
"ubuntu-12.04" => [
|
217
|
-
{ :name => "owner-id", :values => %w{099720109477} },
|
218
|
-
{ :name => "name", :values => %w{ubuntu/images/*/ubuntu-*-12.04*} },
|
219
|
-
],
|
220
|
-
"ubuntu-x86_64" => [
|
221
|
-
{ :name => "owner-id", :values => %w{099720109477} },
|
222
|
-
{ :name => "name", :values => %w{ubuntu/images/*/ubuntu-*-*} },
|
223
|
-
{ :name => "architecture", :values => %w{x86_64} },
|
224
|
-
],
|
225
|
-
"ubuntu-14-x86_64" => [
|
226
|
-
{ :name => "owner-id", :values => %w{099720109477} },
|
227
|
-
{ :name => "name", :values => %w{ubuntu/images/*/ubuntu-*-14*} },
|
228
|
-
{ :name => "architecture", :values => %w{x86_64} },
|
229
|
-
],
|
230
|
-
|
231
|
-
"windows" => [
|
232
|
-
{ :name => "owner-alias", :values => %w{amazon} },
|
233
|
-
{ :name => "name", :values => %w{
|
234
|
-
Windows_Server-*-RTM-English-*-Base-*
|
235
|
-
Windows_Server-*-SP*-English-*-Base-*
|
236
|
-
Windows_Server-*-R*_RTM-English-*-Base-*
|
237
|
-
Windows_Server-*-R*_SP*-English-*-Base-*
|
238
|
-
Windows_Server-*-English-Full-Base-*} },
|
239
|
-
],
|
240
|
-
"windows-2008" => [
|
241
|
-
{ :name => "owner-alias", :values => %w{amazon} },
|
242
|
-
{ :name => "name", :values => %w{
|
243
|
-
Windows_Server-2008-RTM-English-*-Base-*
|
244
|
-
Windows_Server-2008-SP*-English-*-Base-*} },
|
245
|
-
],
|
246
|
-
"windows-2012" => [
|
247
|
-
{ :name => "owner-alias", :values => %w{amazon} },
|
248
|
-
{ :name => "name", :values => %w{
|
249
|
-
Windows_Server-2012-RTM-English-*-Base-*
|
250
|
-
Windows_Server-2012-SP*-English-*-Base-*} },
|
251
|
-
],
|
252
|
-
"windows-2012r2" => [
|
253
|
-
{ :name => "owner-alias", :values => %w{amazon} },
|
254
|
-
{ :name => "name", :values => %w{
|
255
|
-
Windows_Server-2012-R2_RTM-English-*-Base-*
|
256
|
-
Windows_Server-2012-R2_SP*-English-*-Base-*} },
|
257
|
-
],
|
258
|
-
"windows-2012sp1" => [
|
259
|
-
{ :name => "owner-alias", :values => %w{amazon} },
|
260
|
-
{ :name => "name", :values => %w{
|
261
|
-
Windows_Server-2012-SP1-English-*-Base-*} },
|
262
|
-
],
|
263
|
-
"windows-2012rtm" => [
|
264
|
-
{ :name => "owner-alias", :values => %w{amazon} },
|
265
|
-
{ :name => "name", :values => %w{
|
266
|
-
Windows_Server-2012-RTM-English-*-Base-*} },
|
267
|
-
],
|
268
|
-
"windows-2012r2sp1" => [
|
269
|
-
{ :name => "owner-alias", :values => %w{amazon} },
|
270
|
-
{ :name => "name", :values => %w{
|
271
|
-
Windows_Server-2012-R2_SP1-English-*-Base-*} },
|
272
|
-
],
|
273
|
-
"windows-2012r2rtm" => [
|
274
|
-
{ :name => "owner-alias", :values => %w{amazon} },
|
275
|
-
{ :name => "name", :values => %w{
|
276
|
-
Windows_Server-2012-R2_RTM-English-*-Base-*} },
|
277
|
-
],
|
278
|
-
"windows-x86_64" => [
|
279
|
-
{ :name => "owner-alias", :values => %w{amazon} },
|
280
|
-
{ :name => "name", :values => %w{
|
281
|
-
Windows_Server-*-RTM-English-*-Base-*
|
282
|
-
Windows_Server-*-SP*-English-*-Base-*
|
283
|
-
Windows_Server-*-R*_RTM-English-*-Base-*
|
284
|
-
Windows_Server-*-R*_SP*-English-*-Base-*
|
285
|
-
Windows_Server-*-English-Full-Base-*} },
|
286
|
-
{ :name => "architecture", :values => %w{x86_64} },
|
287
|
-
],
|
288
|
-
"windows-2012r2-x86_64" => [
|
289
|
-
{ :name => "owner-alias", :values => %w{amazon} },
|
290
|
-
{ :name => "name", :values => %w{
|
291
|
-
Windows_Server-2012-R2_RTM-English-*-Base-*
|
292
|
-
Windows_Server-2012-R2_SP*-English-*-Base-*} },
|
293
|
-
{ :name => "architecture", :values => %w{x86_64} },
|
294
|
-
],
|
295
|
-
"windows-server" => [
|
296
|
-
{ :name => "owner-alias", :values => %w{amazon} },
|
297
|
-
{ :name => "name", :values => %w{
|
298
|
-
Windows_Server-*-RTM-English-*-Base-*
|
299
|
-
Windows_Server-*-SP*-English-*-Base-*
|
300
|
-
Windows_Server-*-R*_RTM-English-*-Base-*
|
301
|
-
Windows_Server-*-R*_SP*-English-*-Base-*
|
302
|
-
Windows_Server-*-English-Full-Base-*} },
|
303
|
-
],
|
304
|
-
"windows-server-2012r2-x86_64" => [
|
305
|
-
{ :name => "owner-alias", :values => %w{amazon} },
|
306
|
-
{ :name => "name", :values => %w{
|
307
|
-
Windows_Server-2012-R2_RTM-English-*-Base-*
|
308
|
-
Windows_Server-2012-R2_SP*-English-*-Base-*} },
|
309
|
-
{ :name => "architecture", :values => %w{x86_64} },
|
310
|
-
],
|
311
|
-
"windows-2016" => [
|
312
|
-
{ :name => "owner-alias", :values => %w{amazon} },
|
313
|
-
{ :name => "name", :values => %w{
|
314
|
-
Windows_Server-2016-English-Full-Base-*} },
|
315
|
-
],
|
316
|
-
}
|
317
|
-
|
318
|
-
describe "Platform defaults" do
|
319
|
-
PLATFORM_SEARCHES.each do |platform_name, filters|
|
320
|
-
context "when platform is #{platform_name}" do
|
321
|
-
let(:image) { FakeImage.new(:name => platform_name.split("-", 2)[0]) }
|
322
|
-
|
323
|
-
it "searches for #{filters} and uses the resulting image" do
|
324
|
-
expect(driver.ec2.resource).
|
325
|
-
to receive(:images).with(:filters => filters).and_return([image])
|
326
|
-
expect(driver.ec2.resource).
|
327
|
-
to receive(:image).with(image.id).and_return(image)
|
328
|
-
|
329
|
-
instance = new_instance(:platform_name => platform_name)
|
330
|
-
expect(instance.driver.instance_generator.ec2_instance_data[:image_id]).
|
331
|
-
to eq image.id
|
332
|
-
end
|
333
|
-
end
|
334
|
-
end
|
335
|
-
end
|
336
|
-
|
337
|
-
context "when image_search is provided" do
|
338
|
-
let(:image) { FakeImage.new(:name => "ubuntu") }
|
339
|
-
let(:config) { { :image_search => { :name => "SuperImage" } } }
|
340
|
-
|
341
|
-
context "and platform.name is a well known platform name" do
|
342
|
-
it "searches for an image id without using the standard filters" do
|
343
|
-
expect(driver.ec2.resource).
|
344
|
-
to receive(:images).
|
345
|
-
with(:filters => [{ :name => "name", :values => %w{SuperImage} }]).
|
346
|
-
and_return([image])
|
347
|
-
expect(driver.ec2.resource).
|
348
|
-
to receive(:image).with(image.id).and_return(image)
|
349
|
-
|
350
|
-
instance = new_instance(:platform_name => "ubuntu")
|
351
|
-
expect(instance.driver.instance_generator.ec2_instance_data[:image_id]).
|
352
|
-
to eq image.id
|
353
|
-
end
|
354
|
-
end
|
355
|
-
|
356
|
-
context "and platform.name is not a well known platform name" do
|
357
|
-
let(:image) { FakeImage.new(:name => "ubuntu") }
|
358
|
-
it "does not search for (or find) an image, and informs the user they need to set image_id" do
|
359
|
-
expect(driver.ec2.resource).
|
360
|
-
to receive(:images).
|
361
|
-
with(:filters => [{ :name => "name", :values => %w{SuperImage} }]).
|
362
|
-
and_return([image])
|
363
|
-
expect(driver.ec2.resource).
|
364
|
-
to receive(:image).with(image.id).and_return(image)
|
365
|
-
|
366
|
-
instance = new_instance(:platform_name => "blarghle")
|
367
|
-
expect(instance.driver.instance_generator.ec2_instance_data[:image_id]).to eq image.id
|
368
|
-
end
|
369
|
-
end
|
370
|
-
end
|
371
|
-
end
|