Class: Jets::Cfn::Status
- Inherits:
-
CfnStatus
- Object
- CfnStatus
- Jets::Cfn::Status
- Extended by:
- Memoist
- Defined in:
- lib/jets/cfn/status.rb
Instance Method Summary collapse
- #failure_message! ⇒ Object
- #find_failed_event ⇒ Object
-
#initialize(stack_name = Jets::Names.parent_stack_name, options = {}) ⇒ Status
constructor
A new instance of Status.
- #show_nested_stack_error ⇒ Object
Constructor Details
#initialize(stack_name = Jets::Names.parent_stack_name, options = {}) ⇒ Status
Returns a new instance of Status.
7 8 9 |
# File 'lib/jets/cfn/status.rb', line 7 def initialize(stack_name = Jets::Names.parent_stack_name, ={}) super(stack_name, ) end |
Instance Method Details
#failure_message! ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/jets/cfn/status.rb', line 11 def puts <<~EOL The Jets application failed to deploy. Jets creates a few CloudFormation stacks to deploy your application. The logs above show the CloudFormation parent stack events. You can go to the CloudFormation console and look for the nested stack with the error. The specific nested stack usually shows more detailed information and can be used to resolve the issue. Example of checking the CloudFormation console: https://docs.rubyonjets.com/docs/debug/cloudformation/ EOL show_nested_stack_error exit 1 end |
#find_failed_event ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/jets/cfn/status.rb', line 45 def find_failed_event cfn_status = self.class.new # fresh instance to get the refreshed events cfn_status.refresh_events i = cfn_status.start_index events = cfn_status.events[0..i].reverse # events are in reverse chronological order events.find { |e| e.resource_status =~ /FAILED/ } # first failed event end |
#show_nested_stack_error ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/jets/cfn/status.rb', line 29 def show_nested_stack_error event = find_failed_event return unless event puts "-" * 80 puts "Here's the nested stack error details: #{event.resource_status_reason}" self.class.new(event.physical_resource_id, start_index_before_delete: true).run region = Jets.aws.region puts <<~EOL Here's also the AWS Console link to the failed nested stack: https://#{region}.console.aws.amazon.com/cloudformation/home?region=#{region}#/stacks/events?filteringText=&filteringStatus=active&viewNested=true&stackId=#{event.physical_resource_id} EOL end |