Module: Ufo::Stack::Helper

Extended by:
Memoist
Includes:
AwsService, Util
Included in:
Apps, Apps::CfnMap, Base, Ufo::Stack, Context
Defined in:
lib/ufo/stack/helper.rb

Instance Method Summary collapse

Methods included from Util

#default_cluster, #display_params, #execute, #pretty_time, #settings, #task_definition_arns, #user_params

Methods included from AwsService

#cloudformation, #cloudwatchlogs, #ec2, #ecr, #ecs, #elb

Instance Method Details

#adjust_stack_name(cluster, service) ⇒ Object



19
20
21
# File 'lib/ufo/stack/helper.rb', line 19

def adjust_stack_name(cluster, service)
  [cluster, Ufo.pretty_service_name(service)].compact.join('-')
end

#find_stack(stack_name) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/ufo/stack/helper.rb', line 7

def find_stack(stack_name)
  resp = cloudformation.describe_stacks(stack_name: stack_name)
  resp.stacks.first
rescue Aws::CloudFormation::Errors::ValidationError => e
  # example: Stack with id demo-web does not exist
  if e.message =~ /Stack with/ && e.message =~ /does not exist/
    nil
  else
    raise
  end
end

#statusObject



23
24
25
# File 'lib/ufo/stack/helper.rb', line 23

def status
  Status.new(@stack_name)
end