Class: Nucleon::Action::Node::Identity

Inherits:
Object
  • Object
show all
Defined in:
lib/nucleon/action/node/identity.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.describeObject


Info



10
11
12
# File 'lib/nucleon/action/node/identity.rb', line 10

def self.describe
  super(:node, :identity, 700)
end

Instance Method Details

#argumentsObject



33
34
35
# File 'lib/nucleon/action/node/identity.rb', line 33

def arguments
  [ :name, :identity_nodes ]
end

#configureObject


Settings



17
18
19
20
21
22
23
24
25
# File 'lib/nucleon/action/node/identity.rb', line 17

def configure
  super do
    codes :identity_upload_failure
    
    register_str :name
    register_project :identity
    register_nodes :identity_nodes      
  end
end

#executeObject


Operations



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/nucleon/action/node/identity.rb', line 40

def execute
  super do |local_node|
    ensure_network do
      builder = network.identity_builder({ settings[:name] => settings[:identity] })
      
      if builder.build(local_node)
        identity_directory = File.join(builder.build_directory, settings[:name])
        
        success = network.batch(settings[:identity_nodes], settings[:node_provider], settings[:parallel]) do |node|
          info('start', { :provider => node.plugin_provider, :name => node.plugin_name })
          
          remote_network_directory  = node.lookup(:corl_network)
          
          remote_config_directory        = File.join(remote_network_directory, network.config_directory.sub(/#{network.directory}#{File::SEPARATOR}/, ''))            
          remote_identity_base_directory = File.join(remote_network_directory, builder.build_directory.sub(/#{network.directory}#{File::SEPARATOR}/, ''))
          remote_identity_directory      = File.join(remote_identity_base_directory, settings[:name])
          
          node.cli.mkdir('-p', remote_identity_base_directory)
          node.cli.rm('-Rf', remote_identity_directory)
          
          if success = node.send_files(identity_directory, remote_identity_directory, nil, '0700')
            dbg('we were successful!')   
          end        
          success        
        end
      end
      myself.status = code.batch_error unless success
    end
  end
end

#ignoreObject




29
30
31
# File 'lib/nucleon/action/node/identity.rb', line 29

def ignore
  [ :nodes ]
end