stemcell 0.13.2 → 0.14.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 +4 -1
- data/lib/stemcell/launcher.rb +2 -1
- data/lib/stemcell/version.rb +1 -1
- data/spec/lib/stemcell/launcher_spec.rb +45 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 941a58d82b39ad807a558b7d569ffee7f28ad7477f5dbc1cb61c11e8daab9ff4
|
4
|
+
data.tar.gz: 3736e5f1586336821de1d74b249dd64b65b68042de443600cae166a61d054e82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce9ebf93cd89e275e7bcf01cce447936b99686aad8a0fc82ca5ee3982009b508f5ffa7faa0e3b65cb2c310d06fc991a8268262652bd4b083bc53e924e1eded36
|
7
|
+
data.tar.gz: a976b2c11ffb37d4703cf8d5424e3110a01653b6dde3ddcfb6c6879845cbbab6580c5c1c5cca6029ca43fadfe50fe4e64f740fbe4ccadfa38f406c10e58f77ec
|
data/CHANGELOG.md
CHANGED
data/lib/stemcell/launcher.rb
CHANGED
@@ -83,6 +83,7 @@ module Stemcell
|
|
83
83
|
@aws_secret_key = opts['aws_secret_key']
|
84
84
|
@aws_session_token = opts['aws_session_token']
|
85
85
|
@max_attempts = opts['max_attempts'] || 3
|
86
|
+
@bootstrap_template_path = opts['bootstrap_template_path']
|
86
87
|
configure_aws_creds_and_region
|
87
88
|
end
|
88
89
|
|
@@ -257,7 +258,7 @@ module Stemcell
|
|
257
258
|
|
258
259
|
# this is made public for ec2admin usage
|
259
260
|
def render_template(opts={})
|
260
|
-
template_file_path = File.expand_path(TEMPLATE_PATH, __FILE__)
|
261
|
+
template_file_path = @bootstrap_template_path || File.expand_path(TEMPLATE_PATH, __FILE__)
|
261
262
|
template_file = File.read(template_file_path)
|
262
263
|
erb_template = ERB.new(template_file)
|
263
264
|
last_bootstrap_line = LAST_BOOTSTRAP_LINE
|
data/lib/stemcell/version.rb
CHANGED
@@ -23,6 +23,51 @@ describe Stemcell::Launcher do
|
|
23
23
|
end
|
24
24
|
let(:instance_ids) { instances.map(&:id) }
|
25
25
|
|
26
|
+
describe '#render_template' do
|
27
|
+
|
28
|
+
context 'when bootstrap_template_path is not provided' do
|
29
|
+
let(:subject) do
|
30
|
+
launcher.render_template()
|
31
|
+
end
|
32
|
+
|
33
|
+
before do
|
34
|
+
allow(File).to receive(:expand_path).and_return('/path/to/default/bootstrap.sh.erb')
|
35
|
+
allow(File).to receive(:read).and_return('default template content')
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'launches the default template' do
|
39
|
+
expect(File).to receive(:expand_path)
|
40
|
+
expect(File).to receive(:read).with('/path/to/default/bootstrap.sh.erb')
|
41
|
+
|
42
|
+
expect(subject).not_to be_empty
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'when bootstrap_template_path is provided' do
|
47
|
+
let(:subject) do
|
48
|
+
launcher.render_template()
|
49
|
+
end
|
50
|
+
|
51
|
+
let(:launcher) do
|
52
|
+
opts = {'region' => 'region', 'vpc_id' => 'vpc-1', 'bootstrap_template_path' => '/path/to/file.sh.erb'}
|
53
|
+
launcher = Stemcell::Launcher.new(opts)
|
54
|
+
|
55
|
+
launcher
|
56
|
+
end
|
57
|
+
|
58
|
+
before do
|
59
|
+
allow(File).to receive(:read).and_return('custom template content')
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'launches the override template' do
|
63
|
+
expect(File).not_to receive(:expand_path)
|
64
|
+
expect(File).to receive(:read).with('/path/to/file.sh.erb')
|
65
|
+
|
66
|
+
expect(subject).not_to be_empty
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
26
71
|
describe '#launch' do
|
27
72
|
let(:ec2) do
|
28
73
|
ec2 = Aws::EC2::Client.new
|
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.14.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: 2022-
|
14
|
+
date: 2022-07-27 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: aws-eventstream
|