stemcell 0.11.9 → 0.11.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/stemcell/launcher.rb +6 -4
- data/lib/stemcell/metadata_launcher.rb +1 -0
- data/lib/stemcell/option_parser.rb +9 -1
- data/lib/stemcell/version.rb +1 -1
- data/spec/lib/stemcell/launcher_spec.rb +20 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7507325651ec8da0572ef5638823edc4250ba9c7
|
4
|
+
data.tar.gz: 5141fb0f5d90116e1245a233193d144af1b7bb4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02625b23aeefca813c24cdbba7c7886f15f9294938ff78b5b0fcacd599e2404e751db09c414750e29f1b533e13f0997a4abea5535c4d0e9d6d69f0df3e1541a6
|
7
|
+
data.tar.gz: 14009ac687b05b8b8eb931d62b2593ebfcf4eefe0c61f6ab00f156580c8a3e830d3e8bb87e4ac6b0fd1a102f74c396ef15ec16c071463be504edb90d20dc059d
|
data/CHANGELOG.md
CHANGED
data/lib/stemcell/launcher.rb
CHANGED
@@ -78,6 +78,7 @@ module Stemcell
|
|
78
78
|
@aws_access_key = opts['aws_access_key']
|
79
79
|
@aws_secret_key = opts['aws_secret_key']
|
80
80
|
@aws_session_token = opts['aws_session_token']
|
81
|
+
@max_attempts = opts['max_attempts'] || 3
|
81
82
|
configure_aws_creds_and_region
|
82
83
|
end
|
83
84
|
|
@@ -194,8 +195,10 @@ module Stemcell
|
|
194
195
|
@log.info "sent ec2 api tag requests successfully"
|
195
196
|
|
196
197
|
# link to classiclink
|
197
|
-
|
198
|
-
|
198
|
+
if @vpc_id.nil?
|
199
|
+
set_classic_link(instances, opts['classic_link'])
|
200
|
+
@log.info "successfully applied classic link settings (if any)"
|
201
|
+
end
|
199
202
|
|
200
203
|
# turn on termination protection
|
201
204
|
# we do this now to make sure all other settings worked
|
@@ -391,7 +394,6 @@ module Stemcell
|
|
391
394
|
File.read(File.expand_path(opt)) rescue opt
|
392
395
|
end
|
393
396
|
|
394
|
-
MAX_ATTEMPTS = 3
|
395
397
|
INITIAL_RETRY_SEC = 1
|
396
398
|
|
397
399
|
# Return a Hash of instance => error. Empty hash indicates "no error"
|
@@ -404,7 +406,7 @@ module Stemcell
|
|
404
406
|
begin
|
405
407
|
attempt = 0
|
406
408
|
result = nil
|
407
|
-
while attempt <
|
409
|
+
while attempt < @max_attempts
|
408
410
|
# sleep idempotently except for the first attempt
|
409
411
|
sleep(INITIAL_RETRY_SEC * 2 ** attempt) if attempt != 0
|
410
412
|
result = yield(instance)
|
@@ -100,6 +100,7 @@ module Stemcell
|
|
100
100
|
'aws_session_token' => options['aws_session_token'],
|
101
101
|
'region' => options['region'],
|
102
102
|
'vpc_id' => options['vpc_id'],
|
103
|
+
'max_attempts' => options['batch_operation_retries'],
|
103
104
|
})
|
104
105
|
# Slice off just the options used for launching.
|
105
106
|
launch_options = {}
|
@@ -291,7 +291,15 @@ module Stemcell
|
|
291
291
|
:desc => "comma-separated list of contexts to override certain values",
|
292
292
|
:type => String,
|
293
293
|
:env => "CONTEXTS",
|
294
|
-
}
|
294
|
+
},
|
295
|
+
{
|
296
|
+
:name => 'batch_operation_retries',
|
297
|
+
:desc => "maximum number of retries",
|
298
|
+
:type => Integer,
|
299
|
+
:env => 'BATCH_OPERATION_RETRIES',
|
300
|
+
:short => :r,
|
301
|
+
:default => 3,
|
302
|
+
},
|
295
303
|
]
|
296
304
|
|
297
305
|
def initialize(config={})
|
data/lib/stemcell/version.rb
CHANGED
@@ -86,6 +86,8 @@ describe Stemcell::Launcher do
|
|
86
86
|
:user_data => 'template'
|
87
87
|
)).and_return(instances)
|
88
88
|
expect(launcher).to receive(:set_tags).with(kind_of(Array), kind_of(Hash)).and_return(nil)
|
89
|
+
# set_classic_link should not be set on vpc hosts.
|
90
|
+
expect(launcher).not_to receive(:set_classic_link)
|
89
91
|
|
90
92
|
launcher.send(:launch, launch_options)
|
91
93
|
end
|
@@ -155,6 +157,24 @@ describe Stemcell::Launcher do
|
|
155
157
|
end
|
156
158
|
expect(errors.all?(&:nil?)).to be true
|
157
159
|
end
|
160
|
+
|
161
|
+
it "retries up to max_attempts option per instance" do
|
162
|
+
max_attempts = 6
|
163
|
+
opts = {'region' => 'region', 'max_attempts' => max_attempts}
|
164
|
+
launcher = Stemcell::Launcher.new(opts)
|
165
|
+
allow(launcher).to receive(:sleep).and_return(0)
|
166
|
+
tags = double("Tags")
|
167
|
+
instances = (1..2).map do |id|
|
168
|
+
inst = MockInstance.new(id)
|
169
|
+
allow(inst).to receive(:tags).and_return(tags)
|
170
|
+
inst
|
171
|
+
end
|
172
|
+
expect(tags).to receive(:set).with({'a' => 'b'}).exactly(12).times.
|
173
|
+
and_raise(AWS::EC2::Errors::InvalidInstanceID::NotFound.new("error"))
|
174
|
+
expect do
|
175
|
+
launcher.send(:set_tags, instances, {'a' => 'b'})
|
176
|
+
end.to raise_error(Stemcell::IncompleteOperation)
|
177
|
+
end
|
158
178
|
end
|
159
179
|
|
160
180
|
describe '#configure_aws_creds_and_region' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stemcell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Rhoads
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2018-
|
14
|
+
date: 2018-02-28 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: aws-sdk-v1
|
@@ -241,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
241
241
|
version: '0'
|
242
242
|
requirements: []
|
243
243
|
rubyforge_project:
|
244
|
-
rubygems_version: 2.
|
244
|
+
rubygems_version: 2.6.13
|
245
245
|
signing_key:
|
246
246
|
specification_version: 4
|
247
247
|
summary: no summary
|