stemcell 0.10.1 → 0.11.0
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 +10 -0
- data/lib/stemcell/metadata_launcher.rb +2 -0
- data/lib/stemcell/metadata_source.rb +11 -1
- data/lib/stemcell/option_parser.rb +6 -0
- data/lib/stemcell/version.rb +1 -1
- data/spec/lib/stemcell/metadata_source_spec.rb +19 -1
- 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: a75498d7efc84297470587517941d2c008fb5e3c
|
4
|
+
data.tar.gz: 78e9281f72c7cd72c03da98aa0041bb1969ac7b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0b8832be4df37d3599639f88bd093e1924e3ceada6bb0daec655276935fd3b63dd2d42e1df40404c5b867cc64bdacb50174231e85edef80d531c2cd5ee88dae
|
7
|
+
data.tar.gz: c4df4499b664495dc4d94b0ad9188562aa030b0025783f1040fae4a3a21db5908f5dbb660e0286dd11c0bf31f14ca70b419c3b3a7e10a5037eea0e37ce2abb51
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
# 0.11.0
|
2
|
+
- allow user to specify `contexts` to override certain attributes
|
3
|
+
|
4
|
+
# 0.10.1
|
5
|
+
- check for nil classic link
|
6
|
+
|
7
|
+
# 0.10.0
|
8
|
+
- allow launching termination-protected instances
|
9
|
+
- enable classic link
|
10
|
+
|
1
11
|
# 0.9.1
|
2
12
|
- Don't require aws keys for Stemcell::Launcher to allow for launching via iam role
|
3
13
|
|
@@ -35,12 +35,14 @@ module Stemcell
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def determine_options(role, environment, override_options)
|
38
|
+
contexts = override_options.delete('contexts').split(',') rescue []
|
38
39
|
# Initially assume that empty roles are not allowed
|
39
40
|
allow_empty = false
|
40
41
|
begin
|
41
42
|
return source.expand_role(
|
42
43
|
role,
|
43
44
|
environment,
|
45
|
+
contexts,
|
44
46
|
override_options,
|
45
47
|
:allow_empty_roles => allow_empty)
|
46
48
|
rescue EmptyRoleError
|
@@ -43,7 +43,7 @@ module Stemcell
|
|
43
43
|
DEFAULT_OPTIONS.merge(config.default_options)
|
44
44
|
end
|
45
45
|
|
46
|
-
def expand_role(role, environment, override_options={}, options={})
|
46
|
+
def expand_role(role, environment, contexts=[], override_options={}, options={})
|
47
47
|
raise ArgumentError, "Missing chef role" unless role
|
48
48
|
raise ArgumentError, "Missing chef environment" unless environment
|
49
49
|
allow_empty_roles = options.fetch(:allow_empty_roles, false)
|
@@ -55,6 +55,16 @@ module Stemcell
|
|
55
55
|
|
56
56
|
raise EmptyRoleError if !allow_empty_roles && role_empty
|
57
57
|
|
58
|
+
# Step 1.5: Override context specific values
|
59
|
+
if !role_empty
|
60
|
+
context_overrides = role_options['context_overrides'] || {}
|
61
|
+
contexts.each do |context|
|
62
|
+
overriding_hash = context_overrides[context]
|
63
|
+
role_options.merge!(overriding_hash) if overriding_hash
|
64
|
+
end
|
65
|
+
role_options.delete('context_overrides')
|
66
|
+
end
|
67
|
+
|
58
68
|
# Step 2: Determine the backing store from available options.
|
59
69
|
|
60
70
|
# This is determined distinctly from the merge sequence below because
|
@@ -260,6 +260,12 @@ module Stemcell
|
|
260
260
|
:type => nil,
|
261
261
|
:env => 'NON_INTERACTIVE',
|
262
262
|
:short => :f
|
263
|
+
},
|
264
|
+
{
|
265
|
+
:name => 'contexts',
|
266
|
+
:desc => "comma-separated list of contexts to override certain values",
|
267
|
+
:type => String,
|
268
|
+
:env => "CONTEXTS",
|
263
269
|
}
|
264
270
|
]
|
265
271
|
|
data/lib/stemcell/version.rb
CHANGED
@@ -64,6 +64,7 @@ describe Stemcell::MetadataSource do
|
|
64
64
|
let(:backing_options) { Hash.new }
|
65
65
|
let(:availability_zones) { Hash.new }
|
66
66
|
let(:role_metadata) { Hash.new }
|
67
|
+
let(:override_contexts) { Array.new }
|
67
68
|
let(:override_options) { Hash.new }
|
68
69
|
let(:expand_options) { Hash.new }
|
69
70
|
|
@@ -81,6 +82,7 @@ describe Stemcell::MetadataSource do
|
|
81
82
|
metadata_source.expand_role(
|
82
83
|
role,
|
83
84
|
environment,
|
85
|
+
override_contexts,
|
84
86
|
override_options,
|
85
87
|
expand_options)
|
86
88
|
end
|
@@ -209,6 +211,22 @@ describe Stemcell::MetadataSource do
|
|
209
211
|
end
|
210
212
|
end
|
211
213
|
|
214
|
+
context "when context overrides" do
|
215
|
+
before do
|
216
|
+
override_contexts << 'another_account'
|
217
|
+
role_metadata.merge!({'security_groups' => 'default_group'})
|
218
|
+
role_metadata.merge!({'context_overrides' => {'another_account' => {'security_groups' => 'another_group'}}})
|
219
|
+
end
|
220
|
+
|
221
|
+
it 'returns the overrode security groups' do
|
222
|
+
expect(expansion['security_groups']).to eql 'another_group'
|
223
|
+
end
|
224
|
+
|
225
|
+
it 'delete "context_overrides" key from Chef options' do
|
226
|
+
expect(expansion).not_to have_key('context_overrides')
|
227
|
+
end
|
228
|
+
end
|
229
|
+
|
212
230
|
end
|
213
231
|
|
214
232
|
end
|
@@ -247,4 +265,4 @@ describe Stemcell::MetadataSource do
|
|
247
265
|
|
248
266
|
end
|
249
267
|
|
250
|
-
end
|
268
|
+
end
|
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.
|
4
|
+
version: 0.11.0
|
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: 2016-
|
14
|
+
date: 2016-09-14 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: aws-sdk-v1
|
@@ -206,7 +206,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
206
206
|
version: '0'
|
207
207
|
requirements: []
|
208
208
|
rubyforge_project:
|
209
|
-
rubygems_version: 2.4.
|
209
|
+
rubygems_version: 2.4.8
|
210
210
|
signing_key:
|
211
211
|
specification_version: 4
|
212
212
|
summary: no summary
|