Class: Wakame::Actions::LaunchCluster

Inherits:
Wakame::Action show all
Defined in:
lib/wakame/actions/launch_cluster.rb

Constant Summary

Constants included from AttributeHelper

AttributeHelper::CONVERT_CLASSES, AttributeHelper::PRIMITIVE_CLASSES

Instance Attribute Summary

Attributes inherited from Wakame::Action

#trigger

Instance Method Summary collapse

Methods inherited from Wakame::Action

#actor_request, #agent_monitor, #all_subactions_complete?, #bind_triggered_rule, #flush_subactions, #master, #notes, #notify, #notify_queue, #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

Constructor Details

#initializeLaunchCluster

Returns a new instance of LaunchCluster.



4
5
6
# File 'lib/wakame/actions/launch_cluster.rb', line 4

def initialize
  @acquire_lock = true
end

Instance Method Details

#runObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/wakame/actions/launch_cluster.rb', line 8

def run
  if service_cluster.status == Service::ServiceCluster::STATUS_ONLINE
    Wakame.log.info("The service cluster is up & running already")
    raise CancelActionError
  end

  EM.barrier {
    service_cluster.launch
  }

  Wakame.log.debug("#{self.class}: Resource Launch Order: " + service_cluster.dg.levels.collect {|lv| '['+ lv.collect{|prop| "#{prop.class}" }.join(', ') + ']' }.join(', '))

  service_cluster.dg.levels.each { |lv|
    lv.each { |svc_prop|
      trigger_action(PropagateInstances.new(svc_prop))
    }
    flush_subactions
    Wakame.log.debug("#{self.class}: DG level next")
  }
end