Class: StackMate::WaitCondition

Inherits:
Ruote::Participant
  • Object
show all
Includes:
Logging
Defined in:
lib/stackmate/participants/common.rb

Constant Summary collapse

@@handles =
{}
@@conditions =
[]

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Logging

configure_logger_for, #logger, logger_for

Class Method Details

.create_handle(handle_name, handle) ⇒ Object



86
87
88
# File 'lib/stackmate/participants/common.rb', line 86

def self.create_handle(handle_name, handle)
  @@handles[handle_name] = handle
end

.delete_handle(handle_name) ⇒ Object



90
91
92
# File 'lib/stackmate/participants/common.rb', line 90

def self.delete_handle(handle_name)
  @@handles.delete(handle_name)
end

.get_conditionsObject



98
99
100
# File 'lib/stackmate/participants/common.rb', line 98

def self.get_conditions()
  @@conditions
end

Instance Method Details

#createObject



63
64
65
66
67
68
69
# File 'lib/stackmate/participants/common.rb', line 63

def create
  logger.debug "Entering #{workitem.participant_name} "
  workitem[participant_name] = {}
  @@conditions << self
  stackname = workitem.fields['ResolvedNames']['AWS::StackName']
  workitem[participant_name][:physical_id] =  stackname + '-' + 'WaitCondition'
end

#deleteObject



71
72
73
74
# File 'lib/stackmate/participants/common.rb', line 71

def delete
  logger.info "In delete #{participant_name}"
  #no-op
end

#on_workitemObject



76
77
78
79
80
81
82
83
84
# File 'lib/stackmate/participants/common.rb', line 76

def on_workitem
  if workitem['params']['operation'] == 'create'
    create
  else
    #rollback / delete
    delete
    reply
  end
end

#set_handle(handle_name) ⇒ Object



94
95
96
# File 'lib/stackmate/participants/common.rb', line 94

def set_handle(handle_name)
  reply(workitem) if @@handles[handle_name]
end