Sha256: c048811ce152d1f0cc0eea9b8313f6afdb0c2ea8eb0aabb24102a397e532cb30

Contents?: true

Size: 1.69 KB

Versions: 17

Compression:

Stored size: 1.69 KB

Contents

module Nucleon
module Action
module Node
class Start < Nucleon.plugin_class(:nucleon, :cloud_action)
  
  #-----------------------------------------------------------------------------
  # Info
  
  def self.describe
    super(:node, :start, 585)
  end
 
  #-----------------------------------------------------------------------------
  # Settings
  
  def configure
    super do
      register :start_nodes, :array, nil do |values|
        if values.nil?
          warn('corl.actions.start.errors.start_nodes_empty')
          next false 
        end
        
        node_plugins = CORL.loaded_plugins(:CORL, :node)
        success      = true
        
        values.each do |value|
          if info = CORL.plugin_class(:CORL, :node).translate_reference(value)
            if ! node_plugins.keys.include?(info[:provider].to_sym) || info[:name].empty?
              warn('corl.actions.start.errors.start_nodes', { :value => value, :node_provider => info[:provider],  :name => info[:name] })
              success = false
            end
          end
        end
        success
      end
    end
  end

  #---
  
  def ignore
    [ :nodes ]
  end
  
  def arguments
    [ :start_nodes ]
  end

  #-----------------------------------------------------------------------------
  # Operations
   
  def execute
    super do |local_node|
      ensure_network do
        batch_success = network.batch(settings[:start_nodes], settings[:node_provider], settings[:parallel]) do |node|
          info('corl.actions.start.start', { :provider => node.plugin_provider, :name => node.plugin_name })
          node.start 
        end
        myself.status = code.batch_error unless batch_success
      end
    end
  end
end
end
end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
corl-0.5.18 lib/nucleon/action/node/start.rb
corl-0.5.17 lib/nucleon/action/node/start.rb
corl-0.5.16 lib/nucleon/action/node/start.rb
corl-0.5.15 lib/nucleon/action/node/start.rb
corl-0.5.14 lib/nucleon/action/node/start.rb
corl-0.5.13 lib/nucleon/action/node/start.rb
corl-0.5.12 lib/nucleon/action/node/start.rb
corl-0.5.11 lib/nucleon/action/node/start.rb
corl-0.5.10 lib/nucleon/action/node/start.rb
corl-0.5.9 lib/nucleon/action/node/start.rb
corl-0.5.8 lib/nucleon/action/node/start.rb
corl-0.5.7 lib/nucleon/action/node/start.rb
corl-0.5.6 lib/nucleon/action/node/start.rb
corl-0.5.5 lib/nucleon/action/node/start.rb
corl-0.5.4 lib/nucleon/action/node/start.rb
corl-0.5.3 lib/nucleon/action/node/start.rb
corl-0.5.2 lib/nucleon/action/node/start.rb