class Nucleon::Action::Node::Download

Public Class Methods

describe() click to toggle source
Calls superclass method
   # File lib/nucleon/action/node/download.rb
10 def self.describe
11   super(:node, :download, 500)
12 end

Public Instance Methods

arguments() click to toggle source
   # File lib/nucleon/action/node/download.rb
52 def arguments
53   [ :remote_path, :local_path, :download_nodes ]
54 end
configure() click to toggle source
Calls superclass method
   # File lib/nucleon/action/node/download.rb
17 def configure
18   super do
19     register_str :remote_path, nil
20     register_str :local_path, nil
21 
22     register_bool :progress, true
23 
24     register_array :download_nodes, nil do |values|
25       if values.nil?
26         warn('download_nodes_empty')
27         next false
28       end
29 
30       node_plugins = CORL.loaded_plugins(:CORL, :node)
31       success      = true
32 
33       values.each do |value|
34         if info = CORL.plugin_class(:CORL, :node).translate_reference(value)
35           if ! node_plugins.keys.include?(info[:provider].to_sym) || info[:name].empty?
36             warn('download_nodes', { :value => value, :node_provider => info[:provider],  :name => info[:name] })
37             success = false
38           end
39         end
40       end
41       success
42     end
43   end
44 end
execute() click to toggle source
Calls superclass method
   # File lib/nucleon/action/node/download.rb
59 def execute
60   super do |local_node|
61     ensure_network do
62       batch_success = network.batch(settings[:download_nodes], settings[:node_provider], false) do |node|
63         render_options = { :id => node.id, :hostname => node.hostname, :remote_path => settings[:remote_path], :local_path => settings[:local_path] }
64 
65         info('start', render_options)
66         success = node.download(settings[:remote_path], settings[:local_path], { :progress => settings[:progress] })
67 
68         if success
69           success('complete', render_options)
70         else
71           error('failure', render_options)
72         end
73         success
74       end
75       myself.status = code.batch_error unless batch_success
76     end
77   end
78 end
ignore() click to toggle source
   # File lib/nucleon/action/node/download.rb
48 def ignore
49   [ :nodes, :parallel ]
50 end