corl 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +8 -6
- data/VERSION +1 -1
- data/bootstrap/os/ubuntu/00_base.sh +2 -2
- data/bootstrap/os/ubuntu/05_ruby.sh +14 -2
- data/corl.gemspec +175 -5
- data/lib/CORL/builder/identity.rb +1 -1
- data/lib/CORL/builder/package.rb +1 -1
- data/lib/CORL/configuration/file.rb +7 -13
- data/lib/CORL/machine/physical.rb +1 -1
- data/lib/CORL/machine/vagrant.rb +12 -4
- data/lib/CORL/network/CORL.rb +1 -1
- data/lib/CORL/node/AWS.rb +25 -23
- data/lib/CORL/node/local.rb +1 -1
- data/lib/CORL/node/rackspace.rb +13 -15
- data/lib/CORL/node/vagrant.rb +1 -1
- data/lib/CORL/provisioner/puppetnode.rb +1 -1
- data/lib/core/mixin/action/keypair.rb +6 -6
- data/lib/core/mixin/action/registration.rb +39 -11
- data/lib/core/mod/fog_aws_server.rb +1 -3
- data/lib/core/plugin/builder.rb +1 -1
- data/lib/core/plugin/cloud_action.rb +59 -49
- data/lib/core/plugin/configuration.rb +4 -3
- data/lib/core/plugin/fog_machine.rb +10 -2
- data/lib/core/plugin/fog_node.rb +10 -4
- data/lib/core/plugin/machine.rb +2 -8
- data/lib/core/plugin/network.rb +9 -3
- data/lib/core/plugin/node.rb +30 -31
- data/lib/core/plugin/provisioner.rb +1 -1
- data/lib/core/vagrant/Vagrantfile +4 -1
- data/lib/core/vagrant/plugins.rb +6 -4
- data/lib/corl.rb +1 -1
- data/lib/nucleon/action/cloud/config.rb +167 -100
- data/lib/nucleon/action/cloud/create.rb +5 -1
- data/lib/nucleon/action/cloud/images.rb +10 -7
- data/lib/nucleon/action/cloud/inspect.rb +8 -6
- data/lib/nucleon/action/cloud/machines.rb +10 -7
- data/lib/nucleon/action/cloud/regions.rb +13 -8
- data/lib/nucleon/action/cloud/remote.rb +68 -0
- data/lib/nucleon/action/cloud/settings.rb +33 -47
- data/lib/nucleon/action/cloud/vagrantfile.rb +34 -17
- data/lib/nucleon/action/node/IP.rb +2 -2
- data/lib/nucleon/action/node/SSH.rb +3 -3
- data/lib/nucleon/action/node/authorize.rb +2 -2
- data/lib/nucleon/action/node/bootstrap.rb +17 -30
- data/lib/nucleon/action/node/build.rb +4 -4
- data/lib/nucleon/action/node/cache.rb +2 -4
- data/lib/nucleon/action/node/destroy.rb +25 -26
- data/lib/nucleon/action/node/exec.rb +2 -2
- data/lib/nucleon/action/node/fact.rb +10 -5
- data/lib/nucleon/action/node/group.rb +10 -5
- data/lib/nucleon/action/node/identity.rb +6 -8
- data/lib/nucleon/action/node/image.rb +3 -3
- data/lib/nucleon/action/node/keypair.rb +2 -2
- data/lib/nucleon/action/node/lookup.rb +2 -4
- data/lib/nucleon/action/node/provision.rb +2 -2
- data/lib/nucleon/action/node/reboot.rb +3 -3
- data/lib/nucleon/action/node/revoke.rb +2 -2
- data/lib/nucleon/action/node/seed.rb +28 -43
- data/lib/nucleon/action/node/spawn.rb +19 -14
- data/lib/nucleon/action/node/start.rb +3 -3
- data/lib/nucleon/action/node/status.rb +8 -8
- data/lib/nucleon/action/node/stop.rb +3 -3
- data/lib/nucleon/action/plugin/create.rb +10 -13
- data/lib/nucleon/action/plugin/list.rb +7 -7
- data/lib/nucleon/action/plugin/template/nucleon.action.erb +2 -2
- data/lib/nucleon/action/plugins.rb +12 -1
- data/lib/nucleon/event/puppet.rb +1 -1
- data/lib/nucleon/extension/corl_config.rb +26 -0
- data/lib/nucleon/template/environment.rb +1 -1
- data/locales/en.yml +483 -90
- data/rdoc/site/0.5.1/CORL/Build.html +781 -0
- data/rdoc/site/0.5.1/CORL/Builder/Identity.html +596 -0
- data/rdoc/site/0.5.1/CORL/Builder/Package.html +600 -0
- data/rdoc/site/0.5.1/CORL/Builder.html +384 -0
- data/rdoc/site/0.5.1/CORL/Configuration/File.html +1186 -0
- data/rdoc/site/0.5.1/CORL/Configuration.html +383 -0
- data/rdoc/site/0.5.1/CORL/Errors.html +383 -0
- data/rdoc/site/0.5.1/CORL/Facade.html +927 -0
- data/rdoc/site/0.5.1/CORL/Machine/AWS.html +777 -0
- data/rdoc/site/0.5.1/CORL/Machine/Fog.html +1313 -0
- data/rdoc/site/0.5.1/CORL/Machine/Physical.html +1083 -0
- data/rdoc/site/0.5.1/CORL/Machine/Rackspace.html +558 -0
- data/rdoc/site/0.5.1/CORL/Machine/Vagrant.html +1344 -0
- data/rdoc/site/0.5.1/CORL/Machine.html +387 -0
- data/rdoc/site/0.5.1/CORL/Mixin/Action/Keypair.html +616 -0
- data/rdoc/site/0.5.1/CORL/Mixin/Action/Registration.html +469 -0
- data/rdoc/site/0.5.1/CORL/Mixin/Action.html +384 -0
- data/rdoc/site/0.5.1/CORL/Mixin/Builder/Global.html +628 -0
- data/rdoc/site/0.5.1/CORL/Mixin/Builder/Instance.html +720 -0
- data/rdoc/site/0.5.1/CORL/Mixin/Builder.html +383 -0
- data/rdoc/site/0.5.1/CORL/Mixin/Lookup.html +1315 -0
- data/rdoc/site/0.5.1/CORL/Mixin/Machine/SSH.html +699 -0
- data/rdoc/site/0.5.1/CORL/Mixin/Machine.html +383 -0
- data/rdoc/site/0.5.1/CORL/Mixin/Macro/NetworkSettings.html +508 -0
- data/rdoc/site/0.5.1/CORL/Mixin/Macro.html +383 -0
- data/rdoc/site/0.5.1/CORL/Mixin.html +388 -0
- data/rdoc/site/0.5.1/CORL/Network/CORL.html +435 -0
- data/rdoc/site/0.5.1/CORL/Network.html +383 -0
- data/rdoc/site/0.5.1/CORL/Node/AWS.html +760 -0
- data/rdoc/site/0.5.1/CORL/Node/Fog.html +1268 -0
- data/rdoc/site/0.5.1/CORL/Node/Local.html +468 -0
- data/rdoc/site/0.5.1/CORL/Node/Rackspace.html +753 -0
- data/rdoc/site/0.5.1/CORL/Node/Vagrant.html +1497 -0
- data/rdoc/site/0.5.1/CORL/Node.html +387 -0
- data/rdoc/site/0.5.1/CORL/Plugin/Builder.html +524 -0
- data/rdoc/site/0.5.1/CORL/Plugin/Configuration.html +1294 -0
- data/rdoc/site/0.5.1/CORL/Plugin/Machine.html +1323 -0
- data/rdoc/site/0.5.1/CORL/Plugin/Network.html +1766 -0
- data/rdoc/site/0.5.1/CORL/Plugin/Node.html +4263 -0
- data/rdoc/site/0.5.1/CORL/Plugin/Provisioner.html +1139 -0
- data/rdoc/site/0.5.1/CORL/Plugin.html +673 -0
- data/rdoc/site/0.5.1/CORL/Provisioner/Puppetnode.html +1201 -0
- data/rdoc/site/0.5.1/CORL/Provisioner.html +383 -0
- data/rdoc/site/0.5.1/CORL/Util/Puppet/Resource.html +1082 -0
- data/rdoc/site/0.5.1/CORL/Util/Puppet/ResourceGroup.html +964 -0
- data/rdoc/site/0.5.1/CORL/Util/Puppet.html +1131 -0
- data/rdoc/site/0.5.1/CORL/Util.html +385 -0
- data/rdoc/site/0.5.1/CORL/Vagrant/Config.html +967 -0
- data/rdoc/site/0.5.1/CORL/Vagrant.html +462 -0
- data/rdoc/site/0.5.1/CORL.html +496 -0
- data/rdoc/site/0.5.1/Fog/Compute/AWS/Server.html +467 -0
- data/rdoc/site/0.5.1/Fog/Compute/AWS.html +389 -0
- data/rdoc/site/0.5.1/Fog/Compute/RackspaceV2/Server.html +452 -0
- data/rdoc/site/0.5.1/Fog/Compute/RackspaceV2.html +389 -0
- data/rdoc/site/0.5.1/Fog/Compute.html +384 -0
- data/rdoc/site/0.5.1/Fog.html +384 -0
- data/rdoc/site/0.5.1/Hiera/Backend.html +466 -0
- data/rdoc/site/0.5.1/Hiera/Corl_logger.html +493 -0
- data/rdoc/site/0.5.1/Hiera.html +390 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Cloud/Config.html +978 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Cloud/Create.html +562 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Cloud/Images.html +596 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Cloud/Inspect.html +567 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Cloud/Machines.html +591 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Cloud/Regions.html +591 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Cloud/Settings.html +878 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Cloud/Vagrantfile.html +539 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Cloud.html +390 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Authorize.html +567 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Bootstrap.html +628 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Build.html +550 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Cache.html +773 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Destroy.html +597 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Exec.html +554 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Fact.html +733 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Facts.html +505 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Group.html +729 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Groups.html +505 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Node/IP.html +477 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Identity.html +614 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Image.html +597 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Keypair.html +596 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Lookup.html +579 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Provision.html +577 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Reboot.html +597 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Revoke.html +565 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Node/SSH.html +607 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Seed.html +626 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Spawn.html +699 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Start.html +597 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Status.html +615 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Node/Stop.html +597 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Node.html +406 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Plugin/Create.html +736 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Plugin/List.html +570 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Plugin.html +384 -0
- data/rdoc/site/0.5.1/Nucleon/Action/Plugins.html +435 -0
- data/rdoc/site/0.5.1/Nucleon/Action.html +417 -0
- data/rdoc/site/0.5.1/Nucleon/Config.html +401 -0
- data/rdoc/site/0.5.1/Nucleon/Event/Puppet.html +717 -0
- data/rdoc/site/0.5.1/Nucleon/Event.html +383 -0
- data/rdoc/site/0.5.1/Nucleon/Plugin/Base.html +389 -0
- data/rdoc/site/0.5.1/Nucleon/Plugin/CloudAction.html +894 -0
- data/rdoc/site/0.5.1/Nucleon/Plugin.html +384 -0
- data/rdoc/site/0.5.1/Nucleon/Template/Environment.html +572 -0
- data/rdoc/site/0.5.1/Nucleon/Template.html +383 -0
- data/rdoc/site/0.5.1/Nucleon.html +421 -0
- data/rdoc/site/0.5.1/Object.html +402 -0
- data/rdoc/site/0.5.1/Puppet/DataBinding/Corl.html +389 -0
- data/rdoc/site/0.5.1/Puppet/DataBinding.html +382 -0
- data/rdoc/site/0.5.1/Puppet/Indirector/Corl.html +501 -0
- data/rdoc/site/0.5.1/Puppet/Indirector.html +382 -0
- data/rdoc/site/0.5.1/Puppet/Parser/Functions.html +524 -0
- data/rdoc/site/0.5.1/Puppet/Parser.html +382 -0
- data/rdoc/site/0.5.1/Puppet.html +382 -0
- data/rdoc/site/0.5.1/README_rdoc.html +384 -0
- data/rdoc/site/0.5.1/Vagrant/Config/Loader.html +443 -0
- data/rdoc/site/0.5.1/Vagrant/Config.html +383 -0
- data/rdoc/site/0.5.1/Vagrant/Vagrantfile.html +436 -0
- data/rdoc/site/0.5.1/Vagrant.html +390 -0
- data/rdoc/site/0.5.1/VagrantPlugins/CORL/Action/DeleteCache.html +446 -0
- data/rdoc/site/0.5.1/VagrantPlugins/CORL/Action/InitKeys.html +452 -0
- data/rdoc/site/0.5.1/VagrantPlugins/CORL/Action/LinkNetwork.html +450 -0
- data/rdoc/site/0.5.1/VagrantPlugins/CORL/Action.html +385 -0
- data/rdoc/site/0.5.1/VagrantPlugins/CORL/BaseAction.html +535 -0
- data/rdoc/site/0.5.1/VagrantPlugins/CORL/Command/Launcher.html +577 -0
- data/rdoc/site/0.5.1/VagrantPlugins/CORL/Command.html +383 -0
- data/rdoc/site/0.5.1/VagrantPlugins/CORL/Config/CORL.html +776 -0
- data/rdoc/site/0.5.1/VagrantPlugins/CORL/Config.html +383 -0
- data/rdoc/site/0.5.1/VagrantPlugins/CORL/Plugin.html +389 -0
- data/rdoc/site/0.5.1/VagrantPlugins/CORL/Provisioner/CORL.html +580 -0
- data/rdoc/site/0.5.1/VagrantPlugins/CORL/Provisioner.html +383 -0
- data/rdoc/site/0.5.1/VagrantPlugins/CORL.html +390 -0
- data/rdoc/site/0.5.1/VagrantPlugins.html +390 -0
- data/rdoc/site/0.5.1/created.rid +114 -0
- data/rdoc/site/0.5.1/images/add.png +0 -0
- data/rdoc/site/0.5.1/images/brick.png +0 -0
- data/rdoc/site/0.5.1/images/brick_link.png +0 -0
- data/rdoc/site/0.5.1/images/bug.png +0 -0
- data/rdoc/site/0.5.1/images/bullet_black.png +0 -0
- data/rdoc/site/0.5.1/images/bullet_toggle_minus.png +0 -0
- data/rdoc/site/0.5.1/images/bullet_toggle_plus.png +0 -0
- data/rdoc/site/0.5.1/images/date.png +0 -0
- data/rdoc/site/0.5.1/images/delete.png +0 -0
- data/rdoc/site/0.5.1/images/find.png +0 -0
- data/rdoc/site/0.5.1/images/loadingAnimation.gif +0 -0
- data/rdoc/site/0.5.1/images/macFFBgHack.png +0 -0
- data/rdoc/site/0.5.1/images/package.png +0 -0
- data/rdoc/site/0.5.1/images/page_green.png +0 -0
- data/rdoc/site/0.5.1/images/page_white_text.png +0 -0
- data/rdoc/site/0.5.1/images/page_white_width.png +0 -0
- data/rdoc/site/0.5.1/images/plugin.png +0 -0
- data/rdoc/site/0.5.1/images/ruby.png +0 -0
- data/rdoc/site/0.5.1/images/tag_blue.png +0 -0
- data/rdoc/site/0.5.1/images/tag_green.png +0 -0
- data/rdoc/site/0.5.1/images/transparent.png +0 -0
- data/rdoc/site/0.5.1/images/wrench.png +0 -0
- data/rdoc/site/0.5.1/images/wrench_orange.png +0 -0
- data/rdoc/site/0.5.1/images/zoom.png +0 -0
- data/rdoc/site/0.5.1/index.html +383 -0
- data/rdoc/site/0.5.1/js/darkfish.js +155 -0
- data/rdoc/site/0.5.1/js/jquery.js +18 -0
- data/rdoc/site/0.5.1/js/navigation.js +142 -0
- data/rdoc/site/0.5.1/js/search.js +94 -0
- data/rdoc/site/0.5.1/js/search_index.js +1 -0
- data/rdoc/site/0.5.1/js/searcher.js +228 -0
- data/rdoc/site/0.5.1/rdoc.css +543 -0
- data/rdoc/site/0.5.1/table_of_contents.html +2005 -0
- metadata +174 -4
@@ -8,7 +8,7 @@ module Keypair
|
|
8
8
|
# Options
|
9
9
|
|
10
10
|
def keypair_config
|
11
|
-
|
11
|
+
register_str :private_key, nil, 'corl.core.mixin.action.keypair.options.private_key' do |value|
|
12
12
|
success = true
|
13
13
|
if value
|
14
14
|
file = File.expand_path(value)
|
@@ -25,9 +25,9 @@ module Keypair
|
|
25
25
|
success
|
26
26
|
end
|
27
27
|
|
28
|
-
|
28
|
+
register_bool :require_password, false, 'corl.core.mixin.action.keypair.options.require_password'
|
29
29
|
|
30
|
-
|
30
|
+
register_str :key_type, 'RSA', 'corl.core.mixin.action.keypair.options.key_type' do |value|
|
31
31
|
key_type_choices = [ 'RSA', 'DSA' ]
|
32
32
|
unless key_type_choices.include?(value.to_s.upcase)
|
33
33
|
warn('corl.core.mixin.action.keypair.errors.key_type', { :value => value, :choices => key_type_choices })
|
@@ -35,14 +35,14 @@ module Keypair
|
|
35
35
|
end
|
36
36
|
true
|
37
37
|
end
|
38
|
-
|
38
|
+
register_int :key_bits, 2048, 'corl.core.mixin.action.keypair.options.key_bits' do |value|
|
39
39
|
unless value >= 2048
|
40
40
|
warn('corl.core.mixin.action.keypair.errors.key_bits', { :value => value, :required => 2048 })
|
41
41
|
next false
|
42
42
|
end
|
43
43
|
true
|
44
44
|
end
|
45
|
-
|
45
|
+
register_str :key_comment, '', 'corl.core.mixin.action.keypair.options.key_comment'
|
46
46
|
|
47
47
|
config_subset(keypair_ignore)
|
48
48
|
end
|
@@ -89,7 +89,7 @@ module Keypair
|
|
89
89
|
if key_password
|
90
90
|
key_options[:passphrase] = key_password
|
91
91
|
else
|
92
|
-
warn('
|
92
|
+
warn('no_password')
|
93
93
|
return nil
|
94
94
|
end
|
95
95
|
end
|
@@ -5,24 +5,52 @@ module Action
|
|
5
5
|
module Registration
|
6
6
|
|
7
7
|
#-----------------------------------------------------------------------------
|
8
|
-
#
|
8
|
+
# Registration definitions
|
9
9
|
|
10
|
-
def
|
11
|
-
|
10
|
+
def register_network_provider(name, default = nil, locale = nil, &code)
|
11
|
+
register_plugin_provider(:CORL, :network, name.to_sym, default, locale, &code)
|
12
|
+
end
|
13
|
+
|
14
|
+
#---
|
12
15
|
|
13
|
-
|
14
|
-
|
15
|
-
end
|
16
|
+
def register_network_providers(name, default = nil, locale = nil, &code)
|
17
|
+
register_plugin_providers(:CORL, :network, name.to_sym, default, locale, &code)
|
16
18
|
end
|
17
19
|
|
18
20
|
#---
|
19
21
|
|
20
|
-
def
|
21
|
-
|
22
|
+
def register_network(name, default = nil, locale = nil, &code)
|
23
|
+
register_plugin(:CORL, :network, name.to_sym, default, locale, &code)
|
24
|
+
end
|
25
|
+
|
26
|
+
#---
|
27
|
+
|
28
|
+
def register_networks(name, default = nil, locale = nil, &code)
|
29
|
+
register_plugins(:CORL, :network, name.to_sym, default, locale, &code)
|
30
|
+
end
|
31
|
+
|
32
|
+
#---
|
33
|
+
|
34
|
+
def register_node_provider(name, default = nil, locale = nil, &code)
|
35
|
+
register_plugin_provider(:CORL, :node, name.to_sym, default, locale, &code)
|
36
|
+
end
|
37
|
+
|
38
|
+
#---
|
39
|
+
|
40
|
+
def register_node_providers(name, default = nil, locale = nil, &code)
|
41
|
+
register_plugin_providers(:CORL, :node, name.to_sym, default, locale, &code)
|
42
|
+
end
|
43
|
+
|
44
|
+
#---
|
45
|
+
|
46
|
+
def register_node(name, default = nil, locale = nil, &code)
|
47
|
+
register_plugin(:CORL, :node, name.to_sym, default, locale, &code)
|
48
|
+
end
|
49
|
+
|
50
|
+
#---
|
22
51
|
|
23
|
-
|
24
|
-
|
25
|
-
end
|
52
|
+
def register_nodes(name, default = nil, locale = nil, &code)
|
53
|
+
register_plugins(:CORL, :node, name.to_sym, default, locale, &code)
|
26
54
|
end
|
27
55
|
end
|
28
56
|
end
|
@@ -25,15 +25,13 @@ class Server
|
|
25
25
|
rescue Net::SSH::HostKeyMismatch => error
|
26
26
|
error.remember_host!
|
27
27
|
sleep 0.2
|
28
|
-
reset = true
|
29
28
|
retry
|
30
29
|
|
31
|
-
rescue Net::SSH::ConnectionTimeout, Net::SSH::Disconnect => error
|
30
|
+
rescue Errno::ECONNREFUSED, Net::SSH::ConnectionTimeout, Net::SSH::Disconnect => error
|
32
31
|
if tries > 1
|
33
32
|
sleep(sleep_secs)
|
34
33
|
|
35
34
|
tries -= 1
|
36
|
-
reset = true
|
37
35
|
retry
|
38
36
|
end
|
39
37
|
end
|
data/lib/core/plugin/builder.rb
CHANGED
@@ -29,7 +29,15 @@ end
|
|
29
29
|
|
30
30
|
module Nucleon
|
31
31
|
module Plugin
|
32
|
-
class CloudAction <
|
32
|
+
class CloudAction < Nucleon.plugin_class(:nucleon, :action)
|
33
|
+
|
34
|
+
#-----------------------------------------------------------------------------
|
35
|
+
# Constuctor / Destructor
|
36
|
+
|
37
|
+
def normalize(reload)
|
38
|
+
super
|
39
|
+
init_network unless reload
|
40
|
+
end
|
33
41
|
|
34
42
|
#-----------------------------------------------------------------------------
|
35
43
|
# Property accessor / modifiers
|
@@ -38,6 +46,16 @@ class CloudAction < CORL.plugin_class(:nucleon, :action)
|
|
38
46
|
:corl
|
39
47
|
end
|
40
48
|
|
49
|
+
#---
|
50
|
+
|
51
|
+
def network=network
|
52
|
+
@network = network
|
53
|
+
end
|
54
|
+
|
55
|
+
def network
|
56
|
+
@network
|
57
|
+
end
|
58
|
+
|
41
59
|
#---
|
42
60
|
|
43
61
|
def configure
|
@@ -51,48 +69,19 @@ class CloudAction < CORL.plugin_class(:nucleon, :action)
|
|
51
69
|
# Settings
|
52
70
|
|
53
71
|
def node_config
|
54
|
-
|
72
|
+
register_str :net_remote, :edit, 'corl.core.action.options.net_remote'
|
73
|
+
register_network_provider :net_provider, :corl, [ 'corl.core.action.options.net_provider', 'corl.core.action.errors.network_provider' ]
|
55
74
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
network_plugins = CORL.loaded_plugins(:CORL, :network)
|
61
|
-
|
62
|
-
unless network_plugins.keys.include?(value)
|
63
|
-
warn('corl.core.action.errors.network_provider', { :value => value, :choices => network_plugins.keys.join(", ") })
|
64
|
-
next false
|
65
|
-
end
|
66
|
-
true
|
67
|
-
end
|
68
|
-
register :node_provider, :str, :local, 'corl.core.action.options.node_provider' do |value|
|
69
|
-
value = value.to_sym
|
70
|
-
node_providers = node_plugins.keys
|
71
|
-
|
72
|
-
unless CORL.vagrant? || node_providers.include?(value)
|
73
|
-
warn('corl.core.action.errors.node_provider', { :value => value, :choices => node_providers.join(", ") })
|
74
|
-
next false
|
75
|
-
end
|
76
|
-
true
|
77
|
-
end
|
78
|
-
register :nodes, :array, [], 'corl.core.action.options.nodes' do |values|
|
79
|
-
success = true
|
80
|
-
values.each do |value|
|
81
|
-
if info = CORL.plugin_class(:CORL, :node).translate_reference(value)
|
82
|
-
if ! node_plugins.keys.include?(info[:provider].to_sym) || info[:name].empty?
|
83
|
-
warn('corl.core.action.errors.nodes', { :value => value, :provider => info[:provider], :name => info[:name] })
|
84
|
-
success = false
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
success
|
89
|
-
end
|
75
|
+
register_node_provider :node_provider, :local, [ 'corl.core.action.options.node_provider', 'corl.core.action.errors.node_provider' ]
|
76
|
+
register_nodes :nodes, [], [ 'corl.core.action.options.nodes', 'corl.core.action.errors.nodes' ]
|
77
|
+
|
78
|
+
register_bool :parallel, true, 'corl.core.action.options.parallel'
|
90
79
|
end
|
91
80
|
|
92
81
|
#---
|
93
82
|
|
94
83
|
def node_ignore
|
95
|
-
[ :parallel, :
|
84
|
+
[ :parallel, :node_provider, :nodes ]
|
96
85
|
end
|
97
86
|
|
98
87
|
#-----------------------------------------------------------------------------
|
@@ -107,10 +96,10 @@ class CloudAction < CORL.plugin_class(:nucleon, :action)
|
|
107
96
|
def execute(use_network = true, &code)
|
108
97
|
if use_network
|
109
98
|
super(true, true) do
|
110
|
-
node_exec do |node
|
99
|
+
node_exec do |node|
|
111
100
|
hook_config = { :node => node, :network => network }
|
112
101
|
|
113
|
-
code.call(node
|
102
|
+
code.call(node) if code && extension_check(:exec_init, hook_config)
|
114
103
|
myself.status = extension_set(:exec_exit, status, hook_config)
|
115
104
|
end
|
116
105
|
end
|
@@ -122,7 +111,7 @@ class CloudAction < CORL.plugin_class(:nucleon, :action)
|
|
122
111
|
#---
|
123
112
|
|
124
113
|
def node_exec
|
125
|
-
|
114
|
+
init_network(settings[:net_provider]) unless settings[:net_provider].to_sym == network.plugin_provider
|
126
115
|
|
127
116
|
#
|
128
117
|
# A fork in the road...
|
@@ -134,7 +123,7 @@ class CloudAction < CORL.plugin_class(:nucleon, :action)
|
|
134
123
|
exec_config.delete(:nodes)
|
135
124
|
|
136
125
|
result = node.action(plugin_provider, exec_config) do |op, data|
|
137
|
-
execute_remote(node,
|
126
|
+
execute_remote(node, op, data)
|
138
127
|
end
|
139
128
|
result.status == code.success
|
140
129
|
end
|
@@ -144,8 +133,10 @@ class CloudAction < CORL.plugin_class(:nucleon, :action)
|
|
144
133
|
node = nil
|
145
134
|
node = network.local_node if network
|
146
135
|
|
136
|
+
settings[:net_remote] = sanitize_remote(settings[:net_remote]) if settings.has_key?(:net_remote)
|
137
|
+
|
147
138
|
if validate(node, network)
|
148
|
-
yield(node
|
139
|
+
yield(node) if block_given?
|
149
140
|
else
|
150
141
|
puts "\n" + I18n.t('nucleon.core.exec.help.usage') + ': ' + help + "\n" unless quiet?
|
151
142
|
myself.status = code.validation_failed
|
@@ -155,7 +146,9 @@ class CloudAction < CORL.plugin_class(:nucleon, :action)
|
|
155
146
|
|
156
147
|
#---
|
157
148
|
|
158
|
-
def init_network(path = nil)
|
149
|
+
def init_network(provider = nil, path = nil)
|
150
|
+
provider = extension_set(:network_provider, :corl) unless provider
|
151
|
+
|
159
152
|
# Get network configuration path
|
160
153
|
if CORL.admin?
|
161
154
|
network_path = lookup(:corl_network)
|
@@ -166,20 +159,19 @@ class CloudAction < CORL.plugin_class(:nucleon, :action)
|
|
166
159
|
|
167
160
|
# Load network if it exists
|
168
161
|
network_config = extended_config(:network, { :directory => network_path })
|
169
|
-
network
|
170
|
-
network
|
162
|
+
@network = CORL.network(network_path, network_config, provider)
|
171
163
|
end
|
172
164
|
|
173
165
|
#---
|
174
166
|
|
175
|
-
def execute_remote(node,
|
167
|
+
def execute_remote(node, op, data)
|
176
168
|
# Implement in sub classes if needed
|
177
169
|
data
|
178
170
|
end
|
179
171
|
|
180
172
|
#---
|
181
173
|
|
182
|
-
def ensure_network(
|
174
|
+
def ensure_network(&block)
|
183
175
|
codes :network_failure
|
184
176
|
|
185
177
|
if network
|
@@ -202,8 +194,26 @@ class CloudAction < CORL.plugin_class(:nucleon, :action)
|
|
202
194
|
#-----------------------------------------------------------------------------
|
203
195
|
# Utilities
|
204
196
|
|
205
|
-
def sanitize_remote(
|
206
|
-
remote && network.remote(remote) ? remote : nil
|
197
|
+
def sanitize_remote(remote)
|
198
|
+
remote && ( ! network || network.remote(remote) ) ? remote : nil
|
199
|
+
end
|
200
|
+
|
201
|
+
#---
|
202
|
+
|
203
|
+
def remote_message(remote)
|
204
|
+
remote ? "#{remote}" : "LOCAL ONLY"
|
205
|
+
end
|
206
|
+
|
207
|
+
#---
|
208
|
+
|
209
|
+
def parse_property_name(property)
|
210
|
+
property = property.clone
|
211
|
+
|
212
|
+
if property.size > 1
|
213
|
+
property.shift.to_s + '[' + property.join('][') + ']'
|
214
|
+
else
|
215
|
+
property.shift.to_s
|
216
|
+
end
|
207
217
|
end
|
208
218
|
end
|
209
219
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
module CORL
|
3
3
|
module Plugin
|
4
|
-
class Configuration <
|
4
|
+
class Configuration < Nucleon.plugin_class(:nucleon, :base)
|
5
5
|
|
6
6
|
include Mixin::SubConfig
|
7
7
|
|
@@ -21,6 +21,7 @@ class Configuration < CORL.plugin_class(:nucleon, :base)
|
|
21
21
|
init_subconfig(true) unless reload
|
22
22
|
|
23
23
|
logger.info("Setting source configuration project")
|
24
|
+
|
24
25
|
@project = CORL.project(extended_config(:project, {
|
25
26
|
:directory => _delete(:directory, Dir.pwd),
|
26
27
|
:url => _delete(:url),
|
@@ -29,7 +30,7 @@ class Configuration < CORL.plugin_class(:nucleon, :base)
|
|
29
30
|
:pull => true,
|
30
31
|
:internal_ip => CORL.public_ip, # Needed for seeding Vagrant VMs
|
31
32
|
:manage_ignore => _delete(:manage_ignore, true)
|
32
|
-
}), _delete(:project_provider))
|
33
|
+
}), _delete(:project_provider, nil)) unless reload
|
33
34
|
|
34
35
|
_init(:autoload, true)
|
35
36
|
_init(:autosave, false)
|
@@ -164,7 +165,7 @@ class Configuration < CORL.plugin_class(:nucleon, :base)
|
|
164
165
|
|
165
166
|
config.clear if method_config.get(:override, false)
|
166
167
|
|
167
|
-
properties = Config.new
|
168
|
+
properties = Config.new({}, {}, true, false)
|
168
169
|
success = yield(method_config, properties) if block_given?
|
169
170
|
|
170
171
|
if success && ! properties.export.empty?
|
@@ -5,9 +5,17 @@ nucleon_require(File.dirname(__FILE__), :machine)
|
|
5
5
|
|
6
6
|
module CORL
|
7
7
|
module Machine
|
8
|
-
class Fog <
|
8
|
+
class Fog < Nucleon.plugin_class(:CORL, :machine)
|
9
9
|
|
10
10
|
include Mixin::Machine::SSH
|
11
|
+
|
12
|
+
#-----------------------------------------------------------------------------
|
13
|
+
# Machine plugin interface
|
14
|
+
|
15
|
+
def normalize(reload)
|
16
|
+
super
|
17
|
+
myself.plugin_name = '' if myself.plugin_provider == myself.plugin_name.to_sym
|
18
|
+
end
|
11
19
|
|
12
20
|
#-----------------------------------------------------------------------------
|
13
21
|
# Checks
|
@@ -71,7 +79,7 @@ class Fog < CORL.plugin_class(:CORL, :machine)
|
|
71
79
|
|
72
80
|
def state
|
73
81
|
return translate_state(server.state) if server
|
74
|
-
|
82
|
+
translate_state(:aborted)
|
75
83
|
end
|
76
84
|
|
77
85
|
#---
|
data/lib/core/plugin/fog_node.rb
CHANGED
@@ -5,7 +5,7 @@ nucleon_require(File.dirname(__FILE__), :node)
|
|
5
5
|
|
6
6
|
module CORL
|
7
7
|
module Node
|
8
|
-
class Fog <
|
8
|
+
class Fog < Nucleon.plugin_class(:CORL, :node)
|
9
9
|
|
10
10
|
#-----------------------------------------------------------------------------
|
11
11
|
# Node plugin interface
|
@@ -13,9 +13,11 @@ class Fog < CORL.plugin_class(:CORL, :node)
|
|
13
13
|
def normalize(reload)
|
14
14
|
super
|
15
15
|
|
16
|
-
|
16
|
+
@region_info = Config.new({}, {}, true, false) unless reload
|
17
|
+
|
18
|
+
myself.region = region
|
17
19
|
|
18
|
-
unless reload
|
20
|
+
unless reload
|
19
21
|
machine_provider = :fog
|
20
22
|
machine_provider = yield if block_given?
|
21
23
|
|
@@ -69,8 +71,12 @@ class Fog < CORL.plugin_class(:CORL, :node)
|
|
69
71
|
|
70
72
|
#---
|
71
73
|
|
74
|
+
def region_info
|
75
|
+
@region_info
|
76
|
+
end
|
77
|
+
|
72
78
|
def regions
|
73
|
-
|
79
|
+
@region_info.keys
|
74
80
|
end
|
75
81
|
|
76
82
|
def region=region
|
data/lib/core/plugin/machine.rb
CHANGED
@@ -1,14 +1,8 @@
|
|
1
1
|
|
2
2
|
module CORL
|
3
3
|
module Plugin
|
4
|
-
class Machine <
|
5
|
-
|
6
|
-
#-----------------------------------------------------------------------------
|
7
|
-
# Machine plugin interface
|
8
|
-
|
9
|
-
def normalize(reload)
|
10
|
-
end
|
11
|
-
|
4
|
+
class Machine < Nucleon.plugin_class(:nucleon, :base)
|
5
|
+
|
12
6
|
#-----------------------------------------------------------------------------
|
13
7
|
# Checks
|
14
8
|
|
data/lib/core/plugin/network.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
module CORL
|
3
3
|
module Plugin
|
4
|
-
class Network <
|
4
|
+
class Network < Nucleon.plugin_class(:nucleon, :base)
|
5
5
|
|
6
6
|
init_plugin_collection(:add_node, :batch)
|
7
7
|
|
@@ -353,6 +353,13 @@ class Network < CORL.plugin_class(:nucleon, :base)
|
|
353
353
|
|
354
354
|
seed_requested = config.has_key?(:seed)
|
355
355
|
seed = config.delete(:seed, false)
|
356
|
+
seed_project = config.get(:project_reference, nil)
|
357
|
+
|
358
|
+
if seed_project.nil?
|
359
|
+
project_provider = myself.config.project.plugin_provider
|
360
|
+
project_remote = myself.config.remote(:edit)
|
361
|
+
seed_project = "#{project_provider}:::#{project_remote}"
|
362
|
+
end
|
356
363
|
|
357
364
|
unless node.cache_setting(:initialized)
|
358
365
|
bootstrap = true unless bootstrap_requested
|
@@ -370,9 +377,8 @@ class Network < CORL.plugin_class(:nucleon, :base)
|
|
370
377
|
|
371
378
|
if success
|
372
379
|
if seed
|
373
|
-
seed_project = config.get(:project_reference, nil)
|
374
380
|
save_config = { :commit => true, :remote => remote_name, :push => true }
|
375
|
-
|
381
|
+
|
376
382
|
if seed_project && remote_name
|
377
383
|
# Reset project remote
|
378
384
|
seed_info = Plugin::Project.translate_reference(seed_project)
|
data/lib/core/plugin/node.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
module CORL
|
3
3
|
module Plugin
|
4
|
-
class Node <
|
4
|
+
class Node < Nucleon.plugin_class(:nucleon, :base)
|
5
5
|
|
6
6
|
include Parallel
|
7
7
|
external_block_exec :exec, :command, :action
|
@@ -372,7 +372,7 @@ class Node < CORL.plugin_class(:nucleon, :base)
|
|
372
372
|
|
373
373
|
def machine_config
|
374
374
|
name = setting(:id)
|
375
|
-
name =
|
375
|
+
name = nil if name.nil? || name.empty?
|
376
376
|
config = Config.new({ :name => name })
|
377
377
|
|
378
378
|
yield(config) if block_given?
|
@@ -1210,46 +1210,45 @@ class Node < CORL.plugin_class(:nucleon, :base)
|
|
1210
1210
|
|
1211
1211
|
#---
|
1212
1212
|
|
1213
|
-
def destroy(options = {})
|
1213
|
+
def destroy(options = {})
|
1214
|
+
config = Config.ensure(options)
|
1214
1215
|
success = true
|
1215
|
-
|
1216
|
-
if
|
1217
|
-
|
1218
|
-
|
1219
|
-
if extension_check(:destroy, { :config => config })
|
1220
|
-
logger.info("Destroying node: #{plugin_name}")
|
1216
|
+
|
1217
|
+
if extension_check(:destroy, { :config => config })
|
1218
|
+
logger.info("Destroying node: #{plugin_name}")
|
1221
1219
|
|
1222
|
-
|
1220
|
+
yield(:config, config) if block_given?
|
1223
1221
|
|
1222
|
+
if machine && machine.created?
|
1224
1223
|
# Shut down machine
|
1225
1224
|
success = machine.destroy(config.export)
|
1226
|
-
|
1227
1225
|
myself.machine = nil
|
1226
|
+
else
|
1227
|
+
logger.warn("Node #{plugin_name} does not have an attached machine or is not created so cannot be destroyed")
|
1228
|
+
end
|
1228
1229
|
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1230
|
+
# Remove SSH keys
|
1231
|
+
if success && delete_keys
|
1232
|
+
# Remove node information
|
1233
|
+
network.delete_node(plugin_provider, plugin_name, false)
|
1233
1234
|
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1235
|
+
network.save({
|
1236
|
+
:commit => true,
|
1237
|
+
:remote => config.get(:remote, :edit),
|
1238
|
+
:message => config.get(:message, "Destroying node #{plugin_name}"),
|
1239
|
+
:push => true
|
1240
|
+
})
|
1241
|
+
end
|
1240
1242
|
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1243
|
+
if success && block_given?
|
1244
|
+
process_success = yield(:process, config)
|
1245
|
+
success = process_success if process_success == false
|
1246
|
+
end
|
1245
1247
|
|
1246
|
-
|
1247
|
-
|
1248
|
-
|
1249
|
-
end
|
1248
|
+
if success
|
1249
|
+
extension(:destroy_success, { :config => config })
|
1250
|
+
clear_cache
|
1250
1251
|
end
|
1251
|
-
else
|
1252
|
-
logger.warn("Node #{plugin_name} does not have an attached machine or is not created so cannot be destroyed")
|
1253
1252
|
end
|
1254
1253
|
success
|
1255
1254
|
end
|
@@ -3,5 +3,8 @@
|
|
3
3
|
#-------------------------------------------------------------------------------
|
4
4
|
#
|
5
5
|
Vagrant.configure('2') do |config|
|
6
|
-
CORL.vagrant_config(File.dirname(__FILE__), config)
|
6
|
+
CORL.vagrant_config(File.dirname(__FILE__), config) do |node, machine, provisioner|
|
7
|
+
provisioner.provision = false
|
8
|
+
#provisioner.dry_run = true
|
9
|
+
end
|
7
10
|
end
|
data/lib/core/vagrant/plugins.rb
CHANGED
@@ -7,7 +7,7 @@ module VagrantPlugins
|
|
7
7
|
module CORL
|
8
8
|
class Plugin < ::Vagrant.plugin('2')
|
9
9
|
|
10
|
-
name '[C]
|
10
|
+
name '[C]luster [O]rchestration and [R]esearch [L]ibrary'
|
11
11
|
description 'The `corl` plugin provides an easy way to develop and test CORL networks locally from within Vagrant.'
|
12
12
|
|
13
13
|
@@directory = File.dirname(__FILE__)
|
@@ -42,9 +42,11 @@ class Plugin < ::Vagrant.plugin('2')
|
|
42
42
|
hook.after Vagrant::Action::Builtin::WaitForCommunicator, Action::InitKeys
|
43
43
|
end
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
45
|
+
if ENV['CORL_LINK_NETWORK']
|
46
|
+
action_hook 'link-network', :machine_action_up do |hook|
|
47
|
+
nucleon_require(@@action_dir, :link_network)
|
48
|
+
hook.after Action::InitKeys, Action::LinkNetwork
|
49
|
+
end
|
48
50
|
end
|
49
51
|
|
50
52
|
action_hook 'delete-cache', :machine_action_destroy do |hook|
|