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.



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/ufo/cfn/stack.rb', line 131

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 e.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