class AwsAsCode::StackStateSemaphore
Attributes
logger[R]
Public Class Methods
new(logger:)
click to toggle source
# File lib/aws_as_code/stack_state_semaphore.rb, line 9 def initialize(logger:) @logger = logger end
Public Instance Methods
wait(stack) { || ... }
click to toggle source
# File lib/aws_as_code/stack_state_semaphore.rb, line 13 def wait(stack) wait_for_stack_availability stack yield wait_for_stack_availability stack end
wait_for_stack_availability(stack)
click to toggle source
# File lib/aws_as_code/stack_state_semaphore.rb, line 19 def wait_for_stack_availability(stack) # Note that stack can have old state cached, hence explicit # .reload here stack.reload.wait_until(max_attempts: 360, delay: 10) do |s| if in_progress? s log_waiting s false else log_proceeding s true end end end
Private Instance Methods
in_progress?(stack)
click to toggle source
# File lib/aws_as_code/stack_state_semaphore.rb, line 57 def in_progress?(stack) stack.stack_status =~ /IN_PROGRESS/ end
log_proceeding(stack)
click to toggle source
# File lib/aws_as_code/stack_state_semaphore.rb, line 47 def log_proceeding(stack) message = format( "Stack %s is in %s state, proceeding", white(stack.name), white(stack.stack_status) ) logger.info message end
log_waiting(stack)
click to toggle source
# File lib/aws_as_code/stack_state_semaphore.rb, line 37 def log_waiting(stack) message = format( "Stack %s is in %s state, waiting...", white(stack.name), white(stack.stack_status) ) logger.info message end