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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 440002a8d4c58fd1329664656e61589e6d174e7330acfa73af957e8d2e690d7c
4
- data.tar.gz: 88a3fe213bfc823772d72296a130b37fca10032c8519597277d377e1abdfd798
3
+ metadata.gz: 941a58d82b39ad807a558b7d569ffee7f28ad7477f5dbc1cb61c11e8daab9ff4
4
+ data.tar.gz: 3736e5f1586336821de1d74b249dd64b65b68042de443600cae166a61d054e82
5
5
  SHA512:
6
- metadata.gz: 80f1c8e2e9f3fee310ff779dfcb9b1b4e7118ed27da2045441747b0783060fb9dc39022a6c23740167f76c9d4655999015a6858d68cdc2c906c73bfb2af99d4e
7
- data.tar.gz: 07ba99d048effdccd90f9a1185449e13e9829cb047d2c16c027c91834accd2610b053b460bc0f5eba8983ca49312a3238d817d9d5946cd81bd57ff4ce021f4b3
6
+ metadata.gz: ce9ebf93cd89e275e7bcf01cce447936b99686aad8a0fc82ca5ee3982009b508f5ffa7faa0e3b65cb2c310d06fc991a8268262652bd4b083bc53e924e1eded36
7
+ data.tar.gz: a976b2c11ffb37d4703cf8d5424e3110a01653b6dde3ddcfb6c6879845cbbab6580c5c1c5cca6029ca43fadfe50fe4e64f740fbe4ccadfa38f406c10e58f77ec
data/CHANGELOG.md CHANGED
@@ -1,4 +1,7 @@
1
- # 0.13.1
1
+ # 0.14.0
2
+ - Adds support for specifying a custom bootstrap template file
3
+
4
+ # 0.13.2
2
5
  - Support for specifying --min-count and --max-count
3
6
 
4
7
  # 0.13.1
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Stemcell
2
- VERSION = "0.13.2"
2
+ VERSION = "0.14.0"
3
3
  end
@@ -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.13.2
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-02-23 00:00:00.000000000 Z
14
+ date: 2022-07-27 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: aws-eventstream