Class: Nucleon::Action::Node::Download
- Inherits:
-
Object
- Object
- Nucleon::Action::Node::Download
- Defined in:
- lib/nucleon/action/node/download.rb
Class Method Summary collapse
-
.describe ⇒ Object
—————————————————————————– Info.
Instance Method Summary collapse
- #arguments ⇒ Object
-
#configure ⇒ Object
—————————————————————————– Settings.
-
#execute ⇒ Object
—————————————————————————– Operations.
-
#ignore ⇒ Object
—.
Class Method Details
.describe ⇒ Object
Info
10 11 12 |
# File 'lib/nucleon/action/node/download.rb', line 10 def self.describe super(:node, :download, 500) end |
Instance Method Details
#arguments ⇒ Object
52 53 54 |
# File 'lib/nucleon/action/node/download.rb', line 52 def arguments [ :remote_path, :local_path, :upload_nodes ] end |
#configure ⇒ Object
Settings
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/nucleon/action/node/download.rb', line 17 def configure super do register_str :remote_path, nil register_str :local_path, nil register_bool :progress, true register_array :download_nodes, nil do |values| if values.nil? warn('download_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('download_nodes', { :value => value, :node_provider => info[:provider], :name => info[:name] }) success = false end end end success end end end |
#execute ⇒ Object
Operations
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/nucleon/action/node/download.rb', line 59 def execute super do |local_node| ensure_network do batch_success = network.batch(settings[:download_nodes], settings[:node_provider], false) do |node| = { :id => node.id, :hostname => node.hostname, :remote_path => settings[:remote_path], :local_path => settings[:local_path] } info('start', ) success = node.download(settings[:remote_path], settings[:local_path], { :progress => settings[:progress] }) if success success('complete', ) else error('failure', ) end success end myself.status = code.batch_error unless batch_success end end end |
#ignore ⇒ Object
48 49 50 |
# File 'lib/nucleon/action/node/download.rb', line 48 def ignore [ :nodes, :parallel ] end |