Class: Wakame::Actions::NotifyChildChanged
- Inherits:
-
Wakame::Action
- Object
- Wakame::Action
- Wakame::Actions::NotifyChildChanged
- Defined in:
- lib/wakame/actions/notify_child_changed.rb
Constant Summary
Constants included from AttributeHelper
AttributeHelper::CLASS_TYPE_KEY, AttributeHelper::CONVERT_CLASSES, AttributeHelper::PRIMITIVE_CLASSES
Instance Attribute Summary
Attributes inherited from Wakame::Action
Instance Method Summary collapse
-
#initialize(svc) ⇒ NotifyChildChanged
constructor
A new instance of NotifyChildChanged.
- #run ⇒ Object
Methods inherited from Wakame::Action
#acquire_lock, #actor_request, #agent_monitor, #all_subactions_complete?, #flush_subactions, #master, #notes, #notify, #on_canceled, #on_failed, #service_cluster, #status=, #subactions, #sync_actor_request, #trigger_action, #walk_subactions
Methods included from ThreadImmutable
#bind_thread, included, #target_thread, #target_thread?, #thread_check
Methods included from AttributeHelper
#dump_attrs, #retrieve_attr_attribute
Constructor Details
#initialize(svc) ⇒ NotifyChildChanged
Returns a new instance of NotifyChildChanged.
4 5 6 |
# File 'lib/wakame/actions/notify_child_changed.rb', line 4 def initialize(svc) @child_svc = svc end |
Instance Method Details
#run ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/wakame/actions/notify_child_changed.rb', line 8 def run parents = StatusDB. { parents = @child_svc.parent_instances } acquire_lock(parents.map{|c| c.resource.class.to_s }.uniq) Wakame.log.debug("#{self.class}: Parent nodes for #{@child_svc.resource.class}: " + parents.map{|c| c.resource.class }.uniq.inspect ) parents.each { |svc| if svc.monitor_status != Service::STATUS_ONLINE next end trigger_action { |proc_action| svc.resource.on_child_changed(svc, proc_action) } } flush_subactions end |