Class: Kybus::AWS::Resource
- Inherits:
-
Object
- Object
- Kybus::AWS::Resource
show all
- Defined in:
- lib/kybus/aws/resource.rb
Instance Method Summary
collapse
Constructor Details
#initialize(config) ⇒ Resource
Returns a new instance of Resource.
6
7
8
9
|
# File 'lib/kybus/aws/resource.rb', line 6
def initialize(config)
@config = config
@region = @config['region'] || 'us-east-1'
end
|
Instance Method Details
#account_id ⇒ Object
11
12
13
|
# File 'lib/kybus/aws/resource.rb', line 11
def account_id
@config['account_id']
end
|
#with_retries(exception, max_retries = 5) ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/kybus/aws/resource.rb', line 15
def with_retries(exception, max_retries = 5)
retry_count = 0
begin
yield
rescue exception
retry_count += 1
unless retry_count <= max_retries
raise "Failed to apply #{self.class} after #{max_retries} attempts due to ongoing updates."
end
sleep_time = 2**retry_count
puts "Update in progress, retrying in #{sleep_time} seconds..."
sleep(sleep_time)
retry
end
end
|