aws-sdk-utils 0.0.7 → 0.0.8

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: 0dc4753b51a279328e2b70a360bc4c00712d8afb
4
- data.tar.gz: 7358fe0dca9db6762b7d794deed8d2a9fa697de1
3
+ metadata.gz: 210b00d46c72637ff46b218dde0c98061baad0e9
4
+ data.tar.gz: 6374d373cb4e2493e6eb2fa91fb9d9d0c7cab495
5
5
  SHA512:
6
- metadata.gz: a08cd4a45d9dae5d87cd6dbef41cfe3c107acc710086da2341cd2a5e1f4af7fbb01692d5caa6b5e527a29d9aa1fe0fc61ffc7d18faf57f9952c05e00984b8035
7
- data.tar.gz: fd9ea551e82a3638a3cd508689e10c9bbc6d037ddfe3c74139c2e99af9d30759823f8040228e683111d1f714ea208cc32af099a598e6eedb61da6cbc2e621547
6
+ metadata.gz: 7d38c854063539ed94bf6f979594fd5ca4f71ffc6d5d40450bb55a3cc5f9e04e7d052b1b680907bf7e14ceaeed951ff1546eed14f958a899c37a80aa2899d6a7
7
+ data.tar.gz: 63e1b35303854903e9bd47cf1523985c2abb4554bbfc4de0358ba71d739466859090ed1fc05a62c26a144198ccf4103c9f341bc52da7fd87b273e73d23a01638
@@ -12,9 +12,14 @@ end
12
12
 
13
13
  bindings = opts[:path_to_yaml].nil? ? nil : YAML.load_file(opts[:path_to_yaml])
14
14
 
15
- outputs = CfndslConverger.new.converge(stack_name: opts[:stack_name],
16
- path_to_stack: opts[:path_to_stack],
17
- bindings: bindings,
18
- fail_on_changes_to_immutable_resource: opts[:fail_on_changes_to_immutable_resource])
15
+ begin
16
+ outputs = CfndslConverger.new.converge(stack_name: opts[:stack_name],
17
+ path_to_stack: opts[:path_to_stack],
18
+ bindings: bindings,
19
+ fail_on_changes_to_immutable_resource: opts[:fail_on_changes_to_immutable_resource])
19
20
 
20
- puts outputs.to_yaml
21
+ puts outputs.to_yaml
22
+ rescue Exception => e
23
+ puts e.message
24
+ exit 1
25
+ end
@@ -35,7 +35,7 @@ class CfndslConverger
35
35
  extras,
36
36
  verbose)
37
37
 
38
- if fail_on_changes_to_immutable_resource
38
+ if fail_on_changes_to_immutable_resource and stack_exists?(stack_name)
39
39
  unsafe_logical_resource_id = ChangesetUtil.new.immutable_resources_that_would_change stack_name: stack_name,
40
40
  template_body: model.to_json
41
41
  if unsafe_logical_resource_id.nil?
@@ -70,12 +70,18 @@ class CfndslConverger
70
70
 
71
71
  private
72
72
 
73
+ def stack_exists?(stack_name)
74
+ cloudformation_client = Aws::CloudFormation::Client.new
75
+ resource = Aws::CloudFormation::Resource.new(client: cloudformation_client)
76
+ resource.stacks.find {|stack| stack.name == stack_name }
77
+ end
78
+
73
79
  def converge_stack(stack_name:,
74
80
  stack_body:)
75
81
 
76
82
  cloudformation_client = Aws::CloudFormation::Client.new
77
83
  resource = Aws::CloudFormation::Resource.new(client: cloudformation_client)
78
- if resource.stacks.find {|stack| stack.name == stack_name }
84
+ if stack_exists?(stack_name)
79
85
  stack = resource.stack(stack_name)
80
86
  begin
81
87
  stack.update(template_body: stack_body,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - someguy