Class: Lono::Cfn::Cancel
- Inherits:
-
Object
- Object
- Lono::Cfn::Cancel
- Includes:
- AwsServices, Utils::Sure
- Defined in:
- lib/lono/cfn/cancel.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Cancel
constructor
A new instance of Cancel.
- #run ⇒ Object
- #status ⇒ Object
Methods included from Utils::Sure
Methods included from AwsServices
#cfn, #ec2, #iam, #s3, #s3_presigner, #s3_resource, #sts
Methods included from AwsServices::Helper
#rollback_complete?, #testing_update?
Methods included from AwsServices::StackSet
#find_stack_set, #stack_set_exists?
Methods included from AwsServices::Stack
Constructor Details
#initialize(options = {}) ⇒ Cancel
Returns a new instance of Cancel.
6 7 8 9 |
# File 'lib/lono/cfn/cancel.rb', line 6 def initialize(={}) = @stack = [:stack] end |
Instance Method Details
#run ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/lono/cfn/cancel.rb', line 11 def run if [:noop] puts "NOOP Canceling #{@stack} stack" return end stack = find_stack(@stack) unless stack puts "The '#{@stack}' stack does not exist. Unable to cancel" exit 1 end puts "Canceling updates to #{@stack}." puts "Current stack status: #{stack.stack_status}" if stack.stack_status == "CREATE_IN_PROGRESS" cfn.delete_stack(stack_name: @stack) puts "Canceling stack creation." elsif stack.stack_status == "UPDATE_IN_PROGRESS" cfn.cancel_update_stack(stack_name: @stack) puts "Canceling stack update." status.wait if [:wait] else puts "The stack is not in a state to that is cancelable: #{stack.stack_status}" end end |
#status ⇒ Object
37 38 39 |
# File 'lib/lono/cfn/cancel.rb', line 37 def status @status ||= Status.new(@stack) end |