Class: Ufo::S3::Rollback
Instance Method Summary
collapse
#logger
#acm, #applicationautoscaling, #aws_options, #cfn, #cloudwatchlogs, #ec2, #ecr, #ecs, #elb, #s3, #ssm_client, #waf_client
#find_stack, #find_stack_resources, #stack_resources, #status, #task_definition_arns
Constructor Details
#initialize(stack) ⇒ Rollback
Returns a new instance of Rollback.
7
8
9
|
# File 'lib/ufo/s3/rollback.rb', line 7
def initialize(stack)
@stack = stack
end
|
Instance Method Details
#complete? ⇒ Boolean
43
44
45
|
# File 'lib/ufo/s3/rollback.rb', line 43
def complete?
stack&.stack_status == 'ROLLBACK_COMPLETE'
end
|
#continue_update ⇒ Object
20
21
22
23
24
25
26
27
28
|
# File 'lib/ufo/s3/rollback.rb', line 20
def continue_update
continue_update?
begin
cfn.continue_update_rollback(stack_name: @stack)
rescue Aws::CloudFormation::Errors::ValidationError => e
logger.info "ERROR: Continue update: #{e.message}".color(:red)
quit 1
end
end
|
#continue_update? ⇒ Boolean
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/ufo/s3/rollback.rb', line 30
def continue_update?
logger.info <<~EOL
The stack is in the UPDATE_ROLLBACK_FAILED state. More info here: https://amzn.to/2IiEjc5
Would you like to try to continue the update rollback? (y/N)
EOL
yes = @options[:yes] ? "y" : $stdin.gets
unless yes =~ /^y/
logger.info "Exiting without continuing the update rollback."
quit 0
end
end
|
#delete_stack ⇒ Object
11
12
13
14
15
16
17
18
|
# File 'lib/ufo/s3/rollback.rb', line 11
def delete_stack
return unless complete?
logger.info "Existing stack in ROLLBACK_COMPLETE state. Deleting stack before continuing."
cfn.delete_stack(stack_name: @stack)
status.wait
status.reset
true
end
|
#stack ⇒ Object
47
48
49
|
# File 'lib/ufo/s3/rollback.rb', line 47
def stack
find_stack(@stack)
end
|