Class: Nucleon::Action::Node::Spawn
- Inherits:
-
Object
- Object
- Nucleon::Action::Node::Spawn
- Includes:
- Mixin::Action::Keypair
- Defined in:
- lib/nucleon/action/node/spawn.rb
Class Method Summary collapse
-
.describe ⇒ Object
—————————————————————————– Info.
Instance Method Summary collapse
- #arguments ⇒ Object
-
#configure ⇒ Object
—————————————————————————- Settings.
-
#execute ⇒ Object
—————————————————————————– Operations.
-
#ignore ⇒ Object
—.
- #node_config ⇒ Object
Class Method Details
.describe ⇒ Object
Info
12 13 14 |
# File 'lib/nucleon/action/node/spawn.rb', line 12 def self.describe super(:node, :spawn, 635) end |
Instance Method Details
#arguments ⇒ Object
53 54 55 |
# File 'lib/nucleon/action/node/spawn.rb', line 53 def arguments [ :node_provider, :image, :hostnames ] end |
#configure ⇒ Object
Settings
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/nucleon/action/node/spawn.rb', line 19 def configure super do codes :key_failure, :node_create_failure register_bool :bootstrap, true register_bool :provision, false register_array :hostnames, nil register_array :groups register_str :region, nil register_str :machine_type, nil register_str :image, nil register_str :user, nil keypair_config config.defaults(CORL.action_config(:node_bootstrap)) config.defaults(CORL.action_config(:node_seed)) end end |
#execute ⇒ Object
Operations
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/nucleon/action/node/spawn.rb', line 60 def execute super do |node| ensure_network do if keypair && keypair_clean hostnames = [] results = [] node_provider = settings.delete(:node_provider) is_parallel = CORL.parallel? && settings[:parallel] if CORL.vagrant? && ! CORL.loaded_plugins(:CORL, :node).keys.include?(node_provider.to_sym) settings[:machine_type] = node_provider settings[:user] = :vagrant unless settings[:user] node_provider = :vagrant end unless settings[:user] settings[:user] = :root end info('start', { :node_provider => node_provider }) settings.delete(:hostnames).each do |hostname| hostnames << extract_hostnames(hostname) end hostnames.flatten.each do |hostname| if hostname.is_a?(Hash) settings[:public_ip] = hostname[:ip] hostname = hostname[:hostname] end if is_parallel results << network.future.add_node(node_provider, hostname, settings.export) else results << network.add_node(node_provider, hostname, settings.export) end end results = results.map { |future| future.value } if is_parallel myself.status = code.batch_error if results.include?(false) else myself.status = code.key_failure end end end end |
#ignore ⇒ Object
49 50 51 |
# File 'lib/nucleon/action/node/spawn.rb', line 49 def ignore node_ignore - [ :parallel, :node_provider ] + [ :bootstrap_nodes ] end |
#node_config ⇒ Object
42 43 44 45 |
# File 'lib/nucleon/action/node/spawn.rb', line 42 def node_config super config[:node_provider].default = nil end |