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

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.describeObject


Info



12
13
14
# File 'lib/nucleon/action/node/identity.rb', line 12

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

Instance Method Details

#argumentsObject



35
36
37
# File 'lib/nucleon/action/node/identity.rb', line 35

def arguments
  [ :name, :identity_nodes ]
end

#configureObject


Settings



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

def configure
  super do
    codes :identity_upload_failure
    
    register :name, :str
    register_project :identity
    register_nodes :identity_nodes      
  end
end

#executeObject


Operations



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
70
71
# File 'lib/nucleon/action/node/identity.rb', line 42

def execute
  super do |local_node, network|
    ensure_network(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('corl.actions.identity.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




31
32
33
# File 'lib/nucleon/action/node/identity.rb', line 31

def ignore
  [ :nodes ]
end