128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
# File 'lib/jets/commands/deploy.rb', line 128
def find_stack(stack_name)
retries = 0
resp = cfn.describe_stacks(stack_name: stack_name)
resp.stacks.first
rescue Aws::CloudFormation::Errors::ValidationError => e
if e.message =~ /Stack with/ && e.message =~ /does not exist/
nil
else
raise
end
rescue Aws::CloudFormation::Errors::Throttling => e
retries += 1
seconds = 2 ** retries
puts "WARN: find_stack #{e.class} #{e.message}".color(:yellow)
puts "Backing off and will retry in #{seconds} seconds."
sleep(seconds)
if seconds > 90
puts "Giving up after #{retries} retries"
else
retry
end
end
|