Class: Nucleon::Action::Node::Seed
- Inherits:
-
Object
- Object
- Nucleon::Action::Node::Seed
- Defined in:
- lib/nucleon/action/node/seed.rb
Class Method Summary collapse
-
.describe ⇒ Object
—————————————————————————– Info.
Instance Method Summary collapse
-
#arguments ⇒ Object
—.
-
#configure ⇒ Object
—————————————————————————– Settings.
-
#execute ⇒ Object
—————————————————————————– Operations.
Class Method Details
.describe ⇒ Object
Info
10 11 12 |
# File 'lib/nucleon/action/node/seed.rb', line 10 def self.describe super(:node, :seed, 625) end |
Instance Method Details
#arguments ⇒ Object
35 36 37 |
# File 'lib/nucleon/action/node/seed.rb', line 35 def arguments [ :project_reference ] end |
#configure ⇒ Object
Settings
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/nucleon/action/node/seed.rb', line 17 def configure super do codes :key_store_failure, :project_failure, :network_load_failure, :node_load_failure, :node_save_failure #--- register_project :project_reference register_str :project_branch, 'master' end config[:parallel].default = false end |
#execute ⇒ Object
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 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 103 104 105 106 |
# File 'lib/nucleon/action/node/seed.rb', line 42 def execute super do |node| info('start') admin_exec do network_path = lookup(:corl_network) backup_path = File.join(Dir.tmpdir(), 'corl') info('deploy_keys') project_class = CORL.plugin_class(:nucleon, :project) if keys = Util::SSH.generate.store if @project_info = project_class.translate_reference(settings[:project_reference], true) project_info = Config.new(@project_info, {}, true, false) else project_info = Config.new({ :provider => :git }, {}, true, false) end project_class.clear_project_info(network_path) info('backup') FileUtils.rm_rf(backup_path) FileUtils.mv(network_path, backup_path) info('seeding') project = CORL.project(extended_config(:project, { :directory => network_path, :reference => project_info.get(:reference, nil), :url => project_info.get(:url, settings[:project_reference]), :revision => project_info.get(:revision, settings[:project_branch]), :create => true, :pull => true, :keys => keys, :internal_ip => CORL.public_ip, # Needed for seeding Vagrant VMs, :new => true }), project_info[:provider]) if project info('finalizing') FileUtils.chmod_R(0600, network_path) FileUtils.rm_rf(backup_path) info('reinitializing') init_network if network.load if node = network.local_node(true) info('updating') myself.status = code.node_save_failure unless node.save else myself.status = code.node_load_failure end else myself.status = code.network_load_failure end else myself.status = code.project_failure end else myself.status = code.key_store_failure end end end end |