autostacker24 2.4.0 → 2.5.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: b40c75af3b46bd97e4a98ccfd51d967e974cf094
4
- data.tar.gz: d0e77352fac3529d7eb83f8703b4b52e2d7051bd
3
+ metadata.gz: 7b54d10abfc1294e6facf1bdf9dac7dc91268cac
4
+ data.tar.gz: b07933b181619c692bcd0ac28859bfed468b0b79
5
5
  SHA512:
6
- metadata.gz: 165a99326d1e8b764845a4d33f7d84f9c9823682adcca19aee7f1e47b4bb009d44d0677a709c5f1f450f6d9d819698ce06721a8a81b0b561465c0b251a048b4a
7
- data.tar.gz: d5355356201f33f8e7b076aa71dd55078b0bc0ca8691907b69e2de3bf2529c671d955e98dd39fb13a9cb62979360a6b93c530e08ad4432ed5efb987b6c446140
6
+ metadata.gz: 3d877ff8f8b12e32b179135069eff7d5a3d6d5caa5fda5aabda6cebc1021cb37bbf06f01ce97f859501f7a4f97393ddc445dc1df2ef13c5f94260f72e5fec470
7
+ data.tar.gz: aa35982f679d5bb82c3084e0934b79e8defc3e211fcfae1285155ac8b4d57aa673ce3f71775fe47d14174dc727db5532fb2331be3f3e36d8b776fbdea82086bb
@@ -28,6 +28,14 @@ module Stacker
28
28
  end
29
29
  end
30
30
 
31
+ # set custom cloudformation parameters
32
+ def cloud_formation_params=(params)
33
+ unless params == @cloud_formation_params
34
+ @lazy_cloud_formation = nil
35
+ @cloud_formation_params = params
36
+ end
37
+ end
38
+
31
39
  def create_or_update_stack(stack_name, template, parameters, parent_stack_name = nil, tags = nil, timeout_in_minutes = DEFAULT_TIMEOUT)
32
40
  if find_stack(stack_name).nil?
33
41
  create_stack(stack_name, template, parameters, parent_stack_name, tags, timeout_in_minutes)
@@ -173,7 +181,7 @@ module Stacker
173
181
 
174
182
  def cloud_formation # lazy CloudFormation client
175
183
  unless @lazy_cloud_formation
176
- params = {}
184
+ params = @cloud_formation_params || {}
177
185
  params[:credentials] = @credentials if @credentials
178
186
  params[:region] = @region if @region
179
187
  @lazy_cloud_formation = Aws::CloudFormation::Client.new(params)
@@ -182,8 +190,14 @@ module Stacker
182
190
  end
183
191
 
184
192
  def template_body(template)
185
- template = File.read(template) if File.exists?(template)
193
+ wd = Dir.getwd()
194
+ if File.exists?(template) # template is a valid filename
195
+ template = File.read(template)
196
+ Dir.chdir(File.dirname(template))
197
+ end
186
198
  AutoStacker24::Preprocessor.preprocess(template)
199
+ ensure
200
+ Dir.chdir(wd)
187
201
  end
188
202
 
189
203
  extend self
@@ -111,14 +111,10 @@ module AutoStacker24
111
111
  i = s.index('@', i + 1)
112
112
  return s, '' if i.nil?
113
113
 
114
- file_match = /\A@file:\/\/([^@\s]+)@?/.match(s[i..-1])
115
- file_curly_match = /\A@\{file:\/\/([^\}]+)\}/.match(s[i..-1])
114
+ file_match = /\A@file:\/\/([^@\s]+)@?/.match(s[i..-1]) || /\A@\{file:\/\/([^\}]+)\}/.match(s[i..-1])
116
115
  if file_match # inline file
117
116
  s = s[0, i] + File.read(file_match[1]) + file_match.post_match
118
117
  i -= 1
119
- elsif file_curly_match # inline file with curly braces
120
- s = s[0, i] + File.read(file_curly_match[1]) + file_curly_match.post_match
121
- i -= 1
122
118
  elsif s[i, 2] =~ /\A@@/ # escape
123
119
  s = s[0, i] + s[i+1..-1]
124
120
  elsif s[i, 2] =~ /\A@(\w|\{)/
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autostacker24
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johannes Mueller
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-10-20 00:00:00.000000000 Z
12
+ date: 2016-11-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk-core