aws-cft-tools 0.1.3 → 0.1.4

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
- SHA1:
3
- metadata.gz: bf914a7a3004e1abd739897b4d1b91b65119c92a
4
- data.tar.gz: c84ce2a9eeba3748c36b41833961c1645be38932
2
+ SHA256:
3
+ metadata.gz: 4499923dca2675cb102a60ef38f7d4d82e16b83e1994f1455ad261b01f2f43a2
4
+ data.tar.gz: a15745bcf5f20afa876b6d2d4a224dc28f5771ae7a8c4ed9c05dd1a18eff1386
5
5
  SHA512:
6
- metadata.gz: 211496b26c6170e2c6ab5fab09947c3eecece848e811fe975dcbf0bb0ce0f3603bfe397ad6aa39c7f44a9a63655e407d14a909afc31e416fbf9ba28c45b5e23c
7
- data.tar.gz: f9628f83d7e26613dfd8e7af0b513aff118287e0af11afae8436726b946c938101eae7488bb6da19d0d167eb06aa4d426a9e8a8c24eb0b66719539bfa53335c3
6
+ metadata.gz: 8aaa1c95c70812853480948df86c02904ece394d86c49ddb966376deb88a7ad0fdba95305be643a405b44b3a1c3b1a43b982a927985141660ee1cb2c7623ca51
7
+ data.tar.gz: 4264f299d6fbf7cfa0266000d0f6e3fff512861cc78ce43f7c41986ce52c373db764760f440a568b6f222cba6ebc9796ee5c0447a7f38fb1f5b791c4b6cb343a
@@ -20,3 +20,6 @@ Metrics/LineLength:
20
20
  Style/FileName:
21
21
  Exclude:
22
22
  - 'lib/aws-cft-tools.rb'
23
+
24
+ Metrics/MethodLength:
25
+ Max: 15
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.4] - 2018-10-18
4
+
5
+ ### Changed
6
+
7
+ * Handled exponential backoff for AWS API Throttling
8
+
3
9
  ## [0.1.3] - 2018-01-05
4
10
 
5
11
  ### Added
data/code.json CHANGED
@@ -8,10 +8,10 @@
8
8
  "repositoryURL": "https://github.com/USSBA/aws-cft-tools",
9
9
  "description": "Command line tools to ease management of AWS infrastructure through CloudFormation",
10
10
  "permissions": {
11
- "license": {
11
+ "licenses": [{
12
12
  "name": "Apache v2",
13
13
  "URL": "https://www.apache.org/licenses/LICENSE-2.0"
14
- },
14
+ }],
15
15
  "usageType": "openSource",
16
16
  "exemptionText": null
17
17
  },
@@ -23,7 +23,14 @@ module AwsCftTools
23
23
  # @param template [AwsCftTools::Template]
24
24
  #
25
25
  def update_stack(template)
26
- aws_client.update_stack(update_stack_params(template))
26
+ throttle_backoff = 0
27
+ begin
28
+ aws_client.update_stack(update_stack_params(template))
29
+ rescue Aws::CloudFormation::Errors::Throttling
30
+ throttle_backoff += 0.5
31
+ sleep 2**throttle_backoff
32
+ retry
33
+ end
27
34
  # we want to wait for the update to complete before we proceed
28
35
  wait_for_stack_operation(:stack_update_complete, template.name)
29
36
  rescue Aws::CloudFormation::Errors::ValidationError => exception
@@ -37,7 +44,14 @@ module AwsCftTools
37
44
  # @param template [AwsCftTools::Template]
38
45
  #
39
46
  def create_stack(template)
40
- aws_client.create_stack(create_stack_params(template))
47
+ throttle_backoff = 0
48
+ begin
49
+ aws_client.create_stack(create_stack_params(template))
50
+ rescue Aws::CloudFormation::Errors::Throttling
51
+ throttle_backoff += 0.5
52
+ sleep 2**throttle_backoff
53
+ retry
54
+ end
41
55
  # we want to wait for the create to complete before we proceed
42
56
  wait_for_stack_operation(:stack_create_complete, template.name)
43
57
  end
@@ -49,15 +63,35 @@ module AwsCftTools
49
63
  # @param template [AwsCftTools::Template]
50
64
  #
51
65
  def delete_stack(template)
52
- aws_client.delete_stack(delete_stack_params(template))
53
- aws_client.wait_until(:stack_delete_complete, stack_name: template.name)
66
+ throttle_backoff = 0
67
+ begin
68
+ aws_client.delete_stack(delete_stack_params(template))
69
+ rescue Aws::CloudFormation::Errors::Throttling
70
+ throttle_backoff += 0.5
71
+ sleep 2**throttle_backoff
72
+ retry
73
+ end
74
+ begin
75
+ aws_client.wait_until(:stack_delete_complete, stack_name: template.name)
76
+ rescue Aws::CloudFormation::Errors::Throttling
77
+ throttle_backoff += 0.5
78
+ sleep 2**throttle_backoff
79
+ retry
80
+ end
54
81
  end
55
82
 
56
83
  private
57
84
 
58
85
  def wait_for_stack_operation(op, stack_name, times_waited = 0)
59
86
  times_waited += 1
60
- aws_client.wait_until(op, stack_name: stack_name)
87
+ throttle_backoff = 0
88
+ begin
89
+ aws_client.wait_until(op, stack_name: stack_name)
90
+ rescue Aws::CloudFormation::Errors::Throttling
91
+ throttle_backoff += 0.5
92
+ sleep 2**throttle_backoff
93
+ retry
94
+ end
61
95
  rescue Aws::Waiters::Errors::FailureStateError
62
96
  raise_if_too_many_retries(stack_name, times_waited)
63
97
  sleep(2**times_waited + 1)
@@ -4,5 +4,5 @@ module AwsCftTools
4
4
  ##
5
5
  # Version of AwsCftTools.
6
6
  #
7
- VERSION = '0.1.3'
7
+ VERSION = '0.1.4'
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-cft-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Small Business Administration
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-05 00:00:00.000000000 Z
11
+ date: 2018-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -316,7 +316,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
316
316
  version: '0'
317
317
  requirements: []
318
318
  rubyforge_project:
319
- rubygems_version: 2.6.13
319
+ rubygems_version: 2.7.7
320
320
  signing_key:
321
321
  specification_version: 4
322
322
  summary: Tools for managing CloudFormation Templates