kitchen-ec2 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2928484fa583fa992ebcf1fa003d63ddaeae94eb
4
- data.tar.gz: 3ad8a26f85c5f05667096e0c305b036a25788411
3
+ metadata.gz: 8f4428e6497e1981ef132bd6c518ca4f347ed0aa
4
+ data.tar.gz: 8f2014042f18b8f1ab66e8b694141535ff365696
5
5
  SHA512:
6
- metadata.gz: c35455b314bd2fd04e239b960ed59b42ec9cc1aab1c4044f7bfa38329679ec8f7644740a76398ff822ae8ea827f424bcb823e14cd3a3fa57e03d0d9104665d3d
7
- data.tar.gz: 0215c4bed37d0f12d6a2f9993c86a2af4dae7d1858673e602270c14bda5e1202a89d729fb062da0297f5c34ca4b8f906648a2c78b18dc63d3c1c7c266ebe8ee1
6
+ metadata.gz: c6f81b68882cb0d853f9b111543373e7c545fa5f57f3c8bf60de9a38aaea237ea2955e6768a632823722e0d482f56444e317c7f670940f2d6db19ebb32946334
7
+ data.tar.gz: a6e0a708723aef725301b6690b83eb5b7807cbb2fd1aff89e2ab86f5f460ce09d59c0a380ff0ecce585178e41cf6caf0dfb6c39d20a1b58013105268ba571dde
data/CHANGELOG.md CHANGED
@@ -1,7 +1,21 @@
1
1
  # Change Log
2
2
 
3
- ## [1.1.0](https://github.com/test-kitchen/kitchen-ec2/tree/1.1.0) (2016-08-09)
4
- [Full Changelog](https://github.com/test-kitchen/kitchen-ec2/compare/v1.0.1...1.1.0)
3
+ ## [1.2.0](https://github.com/test-kitchen/kitchen-ec2/tree/1.2.0) (2016-09-12)
4
+ [Full Changelog](https://github.com/test-kitchen/kitchen-ec2/compare/v1.1.0...1.2.0)
5
+
6
+ **Fixed bugs:**
7
+
8
+ - Turn on eager loading for AWS resources [\#255](https://github.com/test-kitchen/kitchen-ec2/pull/255) ([hfinucane](https://github.com/hfinucane))
9
+
10
+ **Merged pull requests:**
11
+
12
+ - Add optional config for shutdown\_behavior [\#274](https://github.com/test-kitchen/kitchen-ec2/pull/274) ([alexpop](https://github.com/alexpop))
13
+ - pin rack to ~\> 1.0 [\#272](https://github.com/test-kitchen/kitchen-ec2/pull/272) ([mwrock](https://github.com/mwrock))
14
+ - Fix \#268 [\#269](https://github.com/test-kitchen/kitchen-ec2/pull/269) ([gasserk](https://github.com/gasserk))
15
+ - Allow PowerShell script execution [\#234](https://github.com/test-kitchen/kitchen-ec2/pull/234) ([dlukman](https://github.com/dlukman))
16
+
17
+ ## [v1.1.0](https://github.com/test-kitchen/kitchen-ec2/tree/v1.1.0) (2016-08-09)
18
+ [Full Changelog](https://github.com/test-kitchen/kitchen-ec2/compare/v1.0.1...v1.1.0)
5
19
 
6
20
  **Implemented enhancements:**
7
21
 
@@ -15,6 +29,7 @@
15
29
 
16
30
  **Closed issues:**
17
31
 
32
+ - Do not require aws\_ssh\_key\_id in ec2.rb [\#268](https://github.com/test-kitchen/kitchen-ec2/issues/268)
18
33
  - Retrieve AMI IDs from the EC2 API [\#147](https://github.com/test-kitchen/kitchen-ec2/issues/147)
19
34
 
20
35
  ## [v1.0.1](https://github.com/test-kitchen/kitchen-ec2/tree/v1.0.1) (2016-07-20)
@@ -358,4 +373,4 @@
358
373
  ## [v0.1.0](https://github.com/test-kitchen/kitchen-ec2/tree/v0.1.0) (2012-12-27)
359
374
 
360
375
 
361
- \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
376
+ \* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
data/README.md CHANGED
@@ -178,7 +178,8 @@ The ID of the AWS key pair you want to use.
178
178
  The default will be read from the `AWS_SSH_KEY_ID` environment variable if set,
179
179
  or `nil` otherwise.
180
180
 
181
- This must be one of the KeyName values shown by the AWS CLI: `aws ec2 describe-key-pairs`
181
+ If `aws_ssh_key_id` is specified, it must be one of the KeyName values shown by the AWS CLI: `aws ec2 describe-key-pairs`.
182
+ Otherwise, if not specified, you must either have a user pre-provisioned on the AMI, or provision the user using `user_data`.
182
183
 
183
184
  #### `transport.ssh_key`
184
185
 
@@ -290,6 +291,12 @@ The price you bid in order to submit a spot request. An additional step will be
290
291
 
291
292
  The default is `nil`.
292
293
 
294
+ ### `instance_initiated_shutdown_behavior`
295
+
296
+ Control whether an instance should `stop` or `terminate` when shutdown is initiated from the instance using an operating system command for system shutdown.
297
+
298
+ The default is `nil`.
299
+
293
300
  ### block_duration_minutes
294
301
 
295
302
  The [specified duration](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-requests.html#fixed-duration-spot-instances) for a spot instance, in minutes. This value must be a multiple of 60 (60, 120, 180, 240, 300, or 360).
data/kitchen-ec2.gemspec CHANGED
@@ -38,4 +38,8 @@ Gem::Specification.new do |gem|
38
38
  # enforced in CI
39
39
  gem.add_development_dependency "finstyle", "1.4.0"
40
40
  gem.add_development_dependency "climate_control"
41
+
42
+ # github_changelog_generator -> github-api -> oauth2 -> rack
43
+ # rack being unconstrained breaks Ruby 2.1 installs
44
+ gem.add_development_dependency "rack", "~> 1.0"
41
45
  end
@@ -84,6 +84,10 @@ module Kitchen
84
84
  i[:network_interfaces][0][:groups] = i.delete(:security_group_ids)
85
85
  end
86
86
  end
87
+ unless config[:instance_initiated_shutdown_behavior].nil? ||
88
+ config[:instance_initiated_shutdown_behavior].empty?
89
+ i[:instance_initiated_shutdown_behavior] = config[:instance_initiated_shutdown_behavior]
90
+ end
87
91
  i
88
92
  end
89
93
 
@@ -33,6 +33,8 @@ require_relative "aws/standard_platform/windows"
33
33
  require "aws-sdk-core/waiters/errors"
34
34
  require "retryable"
35
35
 
36
+ Aws.eager_autoload!
37
+
36
38
  module Kitchen
37
39
 
38
40
  module Driver
@@ -79,8 +81,7 @@ module Kitchen
79
81
  default_config :interface, nil
80
82
  default_config :http_proxy, ENV["HTTPS_PROXY"] || ENV["HTTP_PROXY"]
81
83
  default_config :retry_limit, 3
82
-
83
- required_config :aws_ssh_key_id
84
+ default_config :instance_initiated_shutdown_behavior, nil
84
85
 
85
86
  def initialize(*args, &block)
86
87
  super
@@ -157,6 +158,12 @@ module Kitchen
157
158
  "the README for more details"
158
159
  end
159
160
  end
161
+ validations[:instance_initiated_shutdown_behavior] = lambda do |attr, val, _driver|
162
+ unless [nil, "stop", "terminate"].include?(val)
163
+ raise "'#{val}' is an invalid value for option '#{attr}'. " \
164
+ "Valid values are 'stop' or 'terminate'"
165
+ end
166
+ end
160
167
 
161
168
  def create(state) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
162
169
  return if state[:server_id]
@@ -510,6 +517,8 @@ module Kitchen
510
517
  Kitchen::Util.outdent!(<<-EOH)
511
518
  <powershell>
512
519
  $logfile="C:\\Program Files\\Amazon\\Ec2ConfigService\\Logs\\kitchen-ec2.log"
520
+ # Allow script execution
521
+ Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force
513
522
  #PS Remoting and & winrm.cmd basic config
514
523
  Enable-PSRemoting -Force -SkipNetworkProfileCheck
515
524
  & winrm.cmd set winrm/config '@{MaxTimeoutms="1800000"}' >> $logfile
@@ -21,6 +21,6 @@ module Kitchen
21
21
  module Driver
22
22
 
23
23
  # Version string for EC2 Test Kitchen driver
24
- EC2_VERSION = "1.1.0"
24
+ EC2_VERSION = "1.2.0"
25
25
  end
26
26
  end
@@ -71,6 +71,29 @@ describe Kitchen::Driver::Aws::InstanceGenerator do
71
71
  end
72
72
 
73
73
  context "when populated with minimum requirements" do
74
+ let(:config) do
75
+ {
76
+ :instance_type => "micro",
77
+ :ebs_optimized => true,
78
+ :image_id => "ami-123",
79
+ :subnet_id => "s-456",
80
+ :private_ip_address => "0.0.0.0"
81
+ }
82
+ end
83
+
84
+ it "returns the minimum data" do
85
+ expect(generator.ec2_instance_data).to eq(
86
+ :instance_type => "micro",
87
+ :ebs_optimized => true,
88
+ :image_id => "ami-123",
89
+ :key_name => nil,
90
+ :subnet_id => "s-456",
91
+ :private_ip_address => "0.0.0.0"
92
+ )
93
+ end
94
+ end
95
+
96
+ context "when populated with ssh key" do
74
97
  let(:config) do
75
98
  {
76
99
  :instance_type => "micro",
@@ -70,14 +70,6 @@ describe Kitchen::Driver::Ec2 do
70
70
  Kitchen::Driver::EC2_VERSION)
71
71
  end
72
72
 
73
- describe "configuration" do
74
- let(:config) { {} }
75
- it "requires :aws_ssh_key_id to be provided" do
76
- expect { driver.finalize_config!(instance) }.to \
77
- raise_error(Kitchen::UserError, /:aws_ssh_key_id/)
78
- end
79
- end
80
-
81
73
  describe "#hostname" do
82
74
  let(:public_dns_name) { nil }
83
75
  let(:private_dns_name) { nil }
@@ -195,6 +187,23 @@ describe Kitchen::Driver::Ec2 do
195
187
  end
196
188
  end
197
189
 
190
+ describe "submit_server with terminate shutdown behaviour" do
191
+ before do
192
+ config[:instance_initiated_shutdown_behavior] = "terminate"
193
+ expect(driver).to receive(:instance).at_least(:once).and_return(instance)
194
+ end
195
+
196
+ it "submits the server request" do
197
+ expect(generator).to receive(:ec2_instance_data).and_return(
198
+ :instance_initiated_shutdown_behavior => "terminate"
199
+ )
200
+ expect(client).to receive(:create_instance).with(
201
+ :min_count => 1, :max_count => 1, :instance_initiated_shutdown_behavior => "terminate"
202
+ )
203
+ driver.submit_server
204
+ end
205
+ end
206
+
198
207
  describe "#submit_spot" do
199
208
  let(:state) { {} }
200
209
  let(:response) {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-ec2
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fletcher Nichol
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-09 00:00:00.000000000 Z
11
+ date: 2016-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen
@@ -184,6 +184,20 @@ dependencies:
184
184
  - - ">="
185
185
  - !ruby/object:Gem::Version
186
186
  version: '0'
187
+ - !ruby/object:Gem::Dependency
188
+ name: rack
189
+ requirement: !ruby/object:Gem::Requirement
190
+ requirements:
191
+ - - "~>"
192
+ - !ruby/object:Gem::Version
193
+ version: '1.0'
194
+ type: :development
195
+ prerelease: false
196
+ version_requirements: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - "~>"
199
+ - !ruby/object:Gem::Version
200
+ version: '1.0'
187
201
  description: A Test Kitchen Driver for Amazon EC2
188
202
  email:
189
203
  - fnichol@nichol.ca
@@ -239,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
239
253
  version: '0'
240
254
  requirements: []
241
255
  rubyforge_project:
242
- rubygems_version: 2.6.6
256
+ rubygems_version: 2.5.1
243
257
  signing_key:
244
258
  specification_version: 4
245
259
  summary: A Test Kitchen Driver for Amazon EC2
@@ -249,3 +263,4 @@ test_files:
249
263
  - spec/kitchen/driver/ec2/instance_generator_spec.rb
250
264
  - spec/kitchen/driver/ec2_spec.rb
251
265
  - spec/spec_helper.rb
266
+ has_rdoc: