Class: Lono::Sets::Delete
- Inherits:
-
Object
- Object
- Lono::Sets::Delete
- Includes:
- AwsServices, Summarize, Utils::Sure
- Defined in:
- lib/lono/sets/delete.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Delete
constructor
A new instance of Delete.
- #run ⇒ Object
Methods included from Utils::Sure
Methods included from Summarize
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 = {}) ⇒ Delete
Returns a new instance of Delete.
7 8 9 10 |
# File 'lib/lono/sets/delete.rb', line 7 def initialize(={}) @options = @stack = [:stack] end |
Instance Method Details
#run ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/lono/sets/delete.rb', line 12 def run = "Deleting #{@stack} stack set." if @options[:noop] puts "NOOP #{}" else desc =<<~EOL Be sure that the emptied StackSet instances is emptied first. You can empty it with a separate command: lono set_instances delete #{@stack} --all This command will only delete the StackSet itself after its been emptied. EOL sure?("Are you sure you want to delete the #{@stack} stack set?", desc) if stack_set_exists?(@stack) cfn.delete_stack_set(stack_set_name: @stack) # resp is an Empty structure, so must get operation_id from status puts else puts "#{@stack.inspect} stack set does not exist".color(:red) return end end rescue Aws::CloudFormation::Errors::StackSetNotEmptyException => e puts "ERROR: #{e.class}: #{e.}".color(:red) puts <<~EOL The stack set must be empty before deleting. Cannot delete stack set until all stack instances are first deleted. If you want to delete all stack instances you can use: lono set_instances delete #{@stack} --all EOL end |