Sha256: 1a0c7240dc7329140f39b216611e03d041f6f75eb4476988e0f01525010ce27a

Contents?: true

Size: 1.19 KB

Versions: 3

Compression:

Stored size: 1.19 KB

Contents

class Lono::Cfn::Deploy
  class Rollback < Base
    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

    def continue_update
      continue_update?
      options = {stack_name: @stack}
      show_options(options, "continue_update_rollback")
      begin
        cfn.continue_update_rollback(options)
      rescue Aws::CloudFormation::Errors::ValidationError => e
        logger.info "ERROR: Continue update: #{e.message}".color(:red)
        quit 1
      end
    end

    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

    def complete?
      stack&.stack_status == 'ROLLBACK_COMPLETE'
    end

    def stack
      find_stack(@stack)
    end
    memoize :stack
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lono-8.0.0.pre.rc3 lib/lono/cfn/deploy/rollback.rb
lono-8.0.0.pre.rc2 lib/lono/cfn/deploy/rollback.rb
lono-8.0.0.pre.rc1 lib/lono/cfn/deploy/rollback.rb