Method: Ufo::Cfn::Stack#handle_stack_error

Defined in:
lib/ufo/cfn/stack.rb

#handle_stack_error(e) ⇒ Object

Assume only first container_definition to get the container info. Stack:arn:aws:cloudformation:… is in ROLLBACK_COMPLETE state and can not be updated.



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/ufo/cfn/stack.rb', line 104

def handle_stack_error(e)
  case e.message
  when /state and can not be updated/
    logger.info "The #{@stack_name} stack is in a state that cannot be updated. Deleted the stack and try again."
    logger.info "ERROR: #{e.message}"
    if message.include?('UPDATE_ROLLBACK_FAILED')
      logger.info "You might be able to do a 'Continue Update Rollback' and skip some resources to get the stack back into a good state."
    end
    url = "https://console.aws.amazon.com/cloudformation/home?region=#{region}"
    logger.info "Here's the CloudFormation console url: #{url}"
    exit 1
  when /No updates are to be performed/
    logger.info "There are no updates to be performed. Exiting.".color(:yellow)
    exit 1
  when /YAML not well-formed/ # happens if a value is a serialize Ruby Object. See: https://gist.github.com/tongueroo/737531d0bc8c92d92b5cd00493e15d9e
    # e.message: Template format error: YAML not well-formed. (line 207, column 9)
    print_code(e)
  else
    raise
  end
end