corl 0.4.29 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +3 -3
- data/Gemfile.lock +16 -13
- data/VERSION +1 -1
- data/bin/corl +21 -1
- data/bootstrap/os/ubuntu/00_base.sh +2 -2
- data/bootstrap/os/ubuntu/06_puppet.sh +7 -12
- data/bootstrap/os/ubuntu/09_nucleon.sh +1 -1
- data/bootstrap/os/ubuntu/10_corl.sh +1 -4
- data/corl.gemspec +193 -40
- data/lib/CORL/builder/identity.rb +68 -0
- data/lib/CORL/builder/package.rb +75 -0
- data/lib/CORL/configuration/file.rb +5 -5
- data/lib/CORL/machine/{aws.rb → AWS.rb} +2 -2
- data/lib/CORL/machine/physical.rb +1 -1
- data/lib/CORL/machine/rackspace.rb +1 -1
- data/lib/CORL/machine/vagrant.rb +2 -2
- data/lib/CORL/network/{default.rb → CORL.rb} +1 -1
- data/lib/CORL/node/{aws.rb → AWS.rb} +1 -1
- data/lib/CORL/node/local.rb +1 -1
- data/lib/CORL/node/vagrant.rb +7 -2
- data/lib/CORL/provisioner/puppetnode.rb +139 -131
- data/lib/core/build.rb +112 -0
- data/lib/core/facade.rb +48 -8
- data/lib/core/mixin/builder.rb +158 -0
- data/lib/core/mixin/lookup.rb +51 -20
- data/lib/core/mixin/machine/ssh.rb +16 -4
- data/lib/core/plugin/builder.rb +49 -0
- data/lib/core/plugin/{action.rb → cloud_action.rb} +22 -16
- data/lib/core/plugin/configuration.rb +9 -3
- data/lib/core/plugin/fog_machine.rb +3 -3
- data/lib/core/plugin/fog_node.rb +1 -1
- data/lib/core/plugin/machine.rb +2 -2
- data/lib/core/plugin/network.rb +39 -10
- data/lib/core/plugin/node.rb +95 -35
- data/lib/core/plugin/provisioner.rb +133 -113
- data/lib/core/util/puppet/resource.rb +1 -1
- data/lib/core/vagrant/actions/delete_cache.rb +7 -1
- data/lib/core/vagrant/commands/launcher.rb +2 -2
- data/lib/core/vagrant/config.rb +29 -2
- data/lib/corl.rb +9 -8
- data/lib/facter/corl_config_ready.rb +1 -1
- data/lib/facter/vagrant_exists.rb +1 -1
- data/lib/nucleon/action/cloud/create.rb +51 -0
- data/lib/nucleon/action/cloud/hiera.rb +61 -0
- data/lib/{CORL/action → nucleon/action/cloud}/images.rb +11 -2
- data/lib/nucleon/action/cloud/inspect.rb +47 -0
- data/lib/{CORL/action → nucleon/action/cloud}/machines.rb +11 -2
- data/lib/{CORL/action → nucleon/action/cloud}/regions.rb +11 -2
- data/lib/{CORL/action → nucleon/action/cloud}/vagrantfile.rb +11 -2
- data/lib/{CORL/action/ip.rb → nucleon/action/node/IP.rb} +11 -2
- data/lib/{CORL/action/ssh.rb → nucleon/action/node/SSH.rb} +15 -7
- data/lib/{CORL/action → nucleon/action/node}/authorize.rb +11 -2
- data/lib/{CORL/action → nucleon/action/node}/bootstrap.rb +13 -4
- data/lib/nucleon/action/node/build.rb +49 -0
- data/lib/{CORL/action → nucleon/action/node}/destroy.rb +14 -5
- data/lib/{CORL/action → nucleon/action/node}/exec.rb +11 -2
- data/lib/{CORL/action → nucleon/action/node}/facts.rb +12 -3
- data/lib/{CORL/action → nucleon/action/node}/image.rb +13 -4
- data/lib/nucleon/action/node/keypair.rb +85 -0
- data/lib/{CORL/action → nucleon/action/node}/lookup.rb +13 -4
- data/lib/{CORL/action → nucleon/action/node}/provision.rb +30 -8
- data/lib/{CORL/action → nucleon/action/node}/reboot.rb +13 -4
- data/lib/{CORL/action → nucleon/action/node}/revoke.rb +11 -2
- data/lib/{CORL/action → nucleon/action/node}/seed.rb +13 -4
- data/lib/{CORL/action → nucleon/action/node}/spawn.rb +19 -9
- data/lib/{CORL/action → nucleon/action/node}/start.rb +13 -4
- data/lib/{CORL/action → nucleon/action/node}/stop.rb +13 -4
- data/lib/{CORL → nucleon}/event/puppet.rb +2 -2
- data/lib/{CORL → nucleon}/template/environment.rb +2 -2
- data/lib/puppet/indirector/corl.rb +7 -4
- data/lib/puppet/parser/functions/corl_resources.rb +1 -0
- data/lib/puppet/parser/functions/global_array.rb +2 -1
- data/lib/puppet/parser/functions/global_hash.rb +2 -1
- data/lib/puppet/parser/functions/global_param.rb +2 -1
- data/lib/puppet/parser/functions/module_array.rb +2 -1
- data/lib/puppet/parser/functions/module_hash.rb +3 -2
- data/lib/puppet/parser/functions/module_param.rb +3 -2
- data/lib/puppet/parser/functions/render.rb +1 -0
- data/locales/en.yml +80 -0
- data/rdoc/site/0.4.29/CORL/Action/Authorize.html +485 -0
- data/rdoc/site/0.4.29/CORL/Action/Bootstrap.html +546 -0
- data/rdoc/site/0.4.29/CORL/Action/Build.html +396 -0
- data/rdoc/site/0.4.29/CORL/Action/Destroy.html +515 -0
- data/rdoc/site/0.4.29/CORL/Action/Exec.html +472 -0
- data/rdoc/site/0.4.29/CORL/Action/Facts.html +398 -0
- data/rdoc/site/0.4.29/CORL/Action/Image.html +515 -0
- data/rdoc/site/0.4.29/CORL/Action/Images.html +514 -0
- data/rdoc/site/0.4.29/CORL/Action/Ip.html +395 -0
- data/rdoc/site/0.4.29/CORL/Action/Keypair.html +494 -0
- data/rdoc/site/0.4.29/CORL/Action/Lookup.html +474 -0
- data/rdoc/site/0.4.29/CORL/Action/Machines.html +509 -0
- data/rdoc/site/0.4.29/CORL/Action/Provision.html +456 -0
- data/rdoc/site/0.4.29/CORL/Action/Reboot.html +515 -0
- data/rdoc/site/0.4.29/CORL/Action/Regions.html +509 -0
- data/rdoc/site/0.4.29/CORL/Action/Revoke.html +483 -0
- data/rdoc/site/0.4.29/CORL/Action/Seed.html +544 -0
- data/rdoc/site/0.4.29/CORL/Action/Spawn.html +616 -0
- data/rdoc/site/0.4.29/CORL/Action/Ssh.html +526 -0
- data/rdoc/site/0.4.29/CORL/Action/Start.html +515 -0
- data/rdoc/site/0.4.29/CORL/Action/Stop.html +515 -0
- data/rdoc/site/0.4.29/CORL/Action/Vagrantfile.html +457 -0
- data/rdoc/site/0.4.29/CORL/Action.html +360 -0
- data/rdoc/site/0.4.29/CORL/Configuration/File.html +1128 -0
- data/rdoc/site/0.4.29/CORL/Configuration.html +339 -0
- data/rdoc/site/0.4.29/CORL/Errors.html +339 -0
- data/rdoc/site/0.4.29/CORL/Event/Puppet.html +673 -0
- data/rdoc/site/0.4.29/CORL/Event.html +339 -0
- data/rdoc/site/0.4.29/CORL/Facade.html +742 -0
- data/rdoc/site/0.4.29/CORL/Machine/Aws.html +733 -0
- data/rdoc/site/0.4.29/CORL/Machine/Fog.html +1269 -0
- data/rdoc/site/0.4.29/CORL/Machine/Physical.html +1039 -0
- data/rdoc/site/0.4.29/CORL/Machine/Rackspace.html +514 -0
- data/rdoc/site/0.4.29/CORL/Machine/Vagrant.html +1300 -0
- data/rdoc/site/0.4.29/CORL/Machine.html +343 -0
- data/rdoc/site/0.4.29/CORL/Mixin/Action/Keypair.html +572 -0
- data/rdoc/site/0.4.29/CORL/Mixin/Action.html +339 -0
- data/rdoc/site/0.4.29/CORL/Mixin/Lookup.html +954 -0
- data/rdoc/site/0.4.29/CORL/Mixin/Machine/SSH.html +643 -0
- data/rdoc/site/0.4.29/CORL/Mixin/Machine.html +339 -0
- data/rdoc/site/0.4.29/CORL/Mixin/Macro/NetworkSettings.html +464 -0
- data/rdoc/site/0.4.29/CORL/Mixin/Macro.html +339 -0
- data/rdoc/site/0.4.29/CORL/Mixin.html +342 -0
- data/rdoc/site/0.4.29/CORL/Network/Default.html +391 -0
- data/rdoc/site/0.4.29/CORL/Network.html +339 -0
- data/rdoc/site/0.4.29/CORL/Node/Aws.html +716 -0
- data/rdoc/site/0.4.29/CORL/Node/Fog.html +1192 -0
- data/rdoc/site/0.4.29/CORL/Node/Local.html +424 -0
- data/rdoc/site/0.4.29/CORL/Node/Rackspace.html +709 -0
- data/rdoc/site/0.4.29/CORL/Node/Vagrant.html +1451 -0
- data/rdoc/site/0.4.29/CORL/Node.html +343 -0
- data/rdoc/site/0.4.29/CORL/Plugin/CloudAction.html +810 -0
- data/rdoc/site/0.4.29/CORL/Plugin.html +339 -0
- data/rdoc/site/0.4.29/CORL/Provisioner/Puppetnode.html +1095 -0
- data/rdoc/site/0.4.29/CORL/Provisioner.html +339 -0
- data/rdoc/site/0.4.29/CORL/Template/Environment.html +528 -0
- data/rdoc/site/0.4.29/CORL/Template.html +339 -0
- data/rdoc/site/0.4.29/CORL/Util/Puppet/Resource.html +1038 -0
- data/rdoc/site/0.4.29/CORL/Util/Puppet/ResourceGroup.html +920 -0
- data/rdoc/site/0.4.29/CORL/Util/Puppet.html +1087 -0
- data/rdoc/site/0.4.29/CORL/Util.html +341 -0
- data/rdoc/site/0.4.29/CORL/Vagrant/Config.html +896 -0
- data/rdoc/site/0.4.29/CORL/Vagrant.html +418 -0
- data/rdoc/site/0.4.29/CORL.html +465 -0
- data/rdoc/site/0.4.29/Facter/Util/Loader.html +396 -0
- data/rdoc/site/0.4.29/Facter/Util.html +339 -0
- data/rdoc/site/0.4.29/Facter.html +339 -0
- data/rdoc/site/0.4.29/Fog/Compute/AWS/Server.html +423 -0
- data/rdoc/site/0.4.29/Fog/Compute/AWS.html +345 -0
- data/rdoc/site/0.4.29/Fog/Compute/RackspaceV2/Server.html +408 -0
- data/rdoc/site/0.4.29/Fog/Compute/RackspaceV2.html +345 -0
- data/rdoc/site/0.4.29/Fog/Compute.html +340 -0
- data/rdoc/site/0.4.29/Fog.html +340 -0
- data/rdoc/site/0.4.29/Hiera/Backend.html +422 -0
- data/rdoc/site/0.4.29/Hiera/Corl_logger.html +449 -0
- data/rdoc/site/0.4.29/Hiera.html +346 -0
- data/rdoc/site/0.4.29/Nucleon/Config.html +357 -0
- data/rdoc/site/0.4.29/Nucleon/Plugin/Base.html +345 -0
- data/rdoc/site/0.4.29/Nucleon/Plugin/Configuration.html +1213 -0
- data/rdoc/site/0.4.29/Nucleon/Plugin/Machine.html +1279 -0
- data/rdoc/site/0.4.29/Nucleon/Plugin/Network.html +1425 -0
- data/rdoc/site/0.4.29/Nucleon/Plugin/Node.html +3715 -0
- data/rdoc/site/0.4.29/Nucleon/Plugin/Provisioner.html +1297 -0
- data/rdoc/site/0.4.29/Nucleon/Plugin.html +344 -0
- data/rdoc/site/0.4.29/Nucleon.html +344 -0
- data/rdoc/site/0.4.29/Object.html +358 -0
- data/rdoc/site/0.4.29/Puppet/DataBinding/Corl.html +345 -0
- data/rdoc/site/0.4.29/Puppet/DataBinding.html +338 -0
- data/rdoc/site/0.4.29/Puppet/Indirector/Corl.html +454 -0
- data/rdoc/site/0.4.29/Puppet/Indirector.html +338 -0
- data/rdoc/site/0.4.29/Puppet/Parser/Functions.html +480 -0
- data/rdoc/site/0.4.29/Puppet/Parser.html +338 -0
- data/rdoc/site/0.4.29/Puppet.html +338 -0
- data/rdoc/site/0.4.29/README_rdoc.html +340 -0
- data/rdoc/site/0.4.29/Vagrant/Config/Loader.html +399 -0
- data/rdoc/site/0.4.29/Vagrant/Config.html +339 -0
- data/rdoc/site/0.4.29/Vagrant/Vagrantfile.html +392 -0
- data/rdoc/site/0.4.29/Vagrant.html +346 -0
- data/rdoc/site/0.4.29/VagrantPlugins/CORL/Action/DeleteCache.html +396 -0
- data/rdoc/site/0.4.29/VagrantPlugins/CORL/Action/InitKeys.html +408 -0
- data/rdoc/site/0.4.29/VagrantPlugins/CORL/Action/LinkNetwork.html +406 -0
- data/rdoc/site/0.4.29/VagrantPlugins/CORL/Action.html +341 -0
- data/rdoc/site/0.4.29/VagrantPlugins/CORL/BaseAction.html +491 -0
- data/rdoc/site/0.4.29/VagrantPlugins/CORL/Command/Launcher.html +533 -0
- data/rdoc/site/0.4.29/VagrantPlugins/CORL/Command.html +339 -0
- data/rdoc/site/0.4.29/VagrantPlugins/CORL/Config/CORL.html +732 -0
- data/rdoc/site/0.4.29/VagrantPlugins/CORL/Config.html +339 -0
- data/rdoc/site/0.4.29/VagrantPlugins/CORL/Plugin.html +345 -0
- data/rdoc/site/0.4.29/VagrantPlugins/CORL/Provisioner/CORL.html +536 -0
- data/rdoc/site/0.4.29/VagrantPlugins/CORL/Provisioner.html +339 -0
- data/rdoc/site/0.4.29/VagrantPlugins/CORL.html +346 -0
- data/rdoc/site/0.4.29/VagrantPlugins.html +346 -0
- data/rdoc/site/0.4.29/created.rid +96 -0
- data/rdoc/site/0.4.29/images/add.png +0 -0
- data/rdoc/site/0.4.29/images/brick.png +0 -0
- data/rdoc/site/0.4.29/images/brick_link.png +0 -0
- data/rdoc/site/0.4.29/images/bug.png +0 -0
- data/rdoc/site/0.4.29/images/bullet_black.png +0 -0
- data/rdoc/site/0.4.29/images/bullet_toggle_minus.png +0 -0
- data/rdoc/site/0.4.29/images/bullet_toggle_plus.png +0 -0
- data/rdoc/site/0.4.29/images/date.png +0 -0
- data/rdoc/site/0.4.29/images/delete.png +0 -0
- data/rdoc/site/0.4.29/images/find.png +0 -0
- data/rdoc/site/0.4.29/images/loadingAnimation.gif +0 -0
- data/rdoc/site/0.4.29/images/macFFBgHack.png +0 -0
- data/rdoc/site/0.4.29/images/package.png +0 -0
- data/rdoc/site/0.4.29/images/page_green.png +0 -0
- data/rdoc/site/0.4.29/images/page_white_text.png +0 -0
- data/rdoc/site/0.4.29/images/page_white_width.png +0 -0
- data/rdoc/site/0.4.29/images/plugin.png +0 -0
- data/rdoc/site/0.4.29/images/ruby.png +0 -0
- data/rdoc/site/0.4.29/images/tag_blue.png +0 -0
- data/rdoc/site/0.4.29/images/tag_green.png +0 -0
- data/rdoc/site/0.4.29/images/transparent.png +0 -0
- data/rdoc/site/0.4.29/images/wrench.png +0 -0
- data/rdoc/site/0.4.29/images/wrench_orange.png +0 -0
- data/rdoc/site/0.4.29/images/zoom.png +0 -0
- data/rdoc/site/0.4.29/index.html +339 -0
- data/rdoc/site/0.4.29/js/darkfish.js +155 -0
- data/rdoc/site/0.4.29/js/jquery.js +18 -0
- data/rdoc/site/0.4.29/js/navigation.js +142 -0
- data/rdoc/site/0.4.29/js/search.js +94 -0
- data/rdoc/site/0.4.29/js/search_index.js +1 -0
- data/rdoc/site/0.4.29/js/searcher.js +228 -0
- data/rdoc/site/0.4.29/rdoc.css +543 -0
- data/rdoc/site/0.4.29/table_of_contents.html +1561 -0
- metadata +192 -45
- data/lib/CORL/action/build.rb +0 -22
- data/lib/CORL/action/keypair.rb +0 -56
- data/lib/core/mod/facter_loader.rb +0 -15
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
|
|
2
|
-
module
|
|
2
|
+
module CORL
|
|
3
3
|
module Plugin
|
|
4
|
-
class Configuration < CORL.plugin_class(:base)
|
|
4
|
+
class Configuration < CORL.plugin_class(:nucleon, :base)
|
|
5
5
|
|
|
6
6
|
include Mixin::SubConfig
|
|
7
7
|
|
|
8
|
+
#---
|
|
9
|
+
|
|
10
|
+
def self.register_ids
|
|
11
|
+
[ :name, :directory ]
|
|
12
|
+
end
|
|
13
|
+
|
|
8
14
|
#-----------------------------------------------------------------------------
|
|
9
15
|
# Configuration plugin interface
|
|
10
16
|
|
|
@@ -22,7 +28,7 @@ class Configuration < CORL.plugin_class(:base)
|
|
|
22
28
|
:create => _delete(:create, false),
|
|
23
29
|
:pull => true,
|
|
24
30
|
:internal_ip => CORL.public_ip, # Needed for seeding Vagrant VMs
|
|
25
|
-
:manage_ignore => true
|
|
31
|
+
:manage_ignore => _delete(:manage_ignore, true)
|
|
26
32
|
}), _delete(:project_provider))
|
|
27
33
|
|
|
28
34
|
_init(:autoload, true)
|
|
@@ -5,7 +5,7 @@ nucleon_require(File.dirname(__FILE__), :machine)
|
|
|
5
5
|
|
|
6
6
|
module CORL
|
|
7
7
|
module Machine
|
|
8
|
-
class Fog < CORL.plugin_class(:machine)
|
|
8
|
+
class Fog < CORL.plugin_class(:CORL, :machine)
|
|
9
9
|
|
|
10
10
|
include Mixin::Machine::SSH
|
|
11
11
|
|
|
@@ -184,7 +184,7 @@ class Fog < CORL.plugin_class(:machine)
|
|
|
184
184
|
def reload(options = {}, &code)
|
|
185
185
|
super do |config|
|
|
186
186
|
success = code ? code.call(config) : true
|
|
187
|
-
success = init_ssh_session(true, config.get(:tries,
|
|
187
|
+
success = init_ssh_session(true, config.get(:tries, 12), config.get(:sleep_time, 5)) if success
|
|
188
188
|
end
|
|
189
189
|
end
|
|
190
190
|
|
|
@@ -195,7 +195,7 @@ class Fog < CORL.plugin_class(:machine)
|
|
|
195
195
|
image_name = sprintf("%s (%s)", node.plugin_name, Time.now.to_s)
|
|
196
196
|
|
|
197
197
|
success = code ? code.call(image_name, config, success) : true
|
|
198
|
-
success = init_ssh_session(true, config.get(:tries,
|
|
198
|
+
success = init_ssh_session(true, config.get(:tries, 12), config.get(:sleep_time, 5)) if success
|
|
199
199
|
end
|
|
200
200
|
end
|
|
201
201
|
|
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 < CORL.plugin_class(:node)
|
|
8
|
+
class Fog < CORL.plugin_class(:CORL, :node)
|
|
9
9
|
|
|
10
10
|
#-----------------------------------------------------------------------------
|
|
11
11
|
# Node plugin interface
|
data/lib/core/plugin/machine.rb
CHANGED
data/lib/core/plugin/network.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
module
|
|
2
|
+
module CORL
|
|
3
3
|
module Plugin
|
|
4
|
-
class Network < CORL.plugin_class(:base)
|
|
4
|
+
class Network < CORL.plugin_class(:nucleon, :base)
|
|
5
5
|
|
|
6
6
|
init_plugin_collection(:add_node, :batch)
|
|
7
7
|
|
|
@@ -11,12 +11,15 @@ class Network < CORL.plugin_class(:base)
|
|
|
11
11
|
def normalize(reload)
|
|
12
12
|
super
|
|
13
13
|
|
|
14
|
-
logger.info("Initializing
|
|
14
|
+
logger.info("Initializing network: reloading? #{reload}")
|
|
15
15
|
myself.config = CORL.configuration(Config.new(myself._export).import({ :autosave => false, :create => false })) unless reload
|
|
16
16
|
|
|
17
17
|
config.delete(:directory) # TODO: Figure out what to do with this??
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
unless reload
|
|
20
|
+
@build = Build.new
|
|
21
|
+
ignore([ 'build', File.join('config', 'identities') ])
|
|
22
|
+
end
|
|
20
23
|
end
|
|
21
24
|
|
|
22
25
|
#---
|
|
@@ -39,15 +42,26 @@ class Network < CORL.plugin_class(:base)
|
|
|
39
42
|
#-----------------------------------------------------------------------------
|
|
40
43
|
# Property accessors / modifiers
|
|
41
44
|
|
|
42
|
-
plugin_collection :node
|
|
43
|
-
plugin_collection :
|
|
45
|
+
plugin_collection :CORL, :node
|
|
46
|
+
plugin_collection :CORL, :builder, :single_instance => true
|
|
47
|
+
plugin_collection :CORL, :provisioner
|
|
48
|
+
|
|
49
|
+
#---
|
|
50
|
+
|
|
51
|
+
def hiera_var
|
|
52
|
+
@hiera
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def hiera_var=hiera
|
|
56
|
+
@hiera = hiera
|
|
57
|
+
end
|
|
44
58
|
|
|
45
59
|
#---
|
|
46
60
|
|
|
47
61
|
def hiera_override_dir
|
|
48
62
|
File.join(directory, 'config')
|
|
49
63
|
end
|
|
50
|
-
|
|
64
|
+
|
|
51
65
|
#---
|
|
52
66
|
|
|
53
67
|
def home
|
|
@@ -68,6 +82,11 @@ class Network < CORL.plugin_class(:base)
|
|
|
68
82
|
|
|
69
83
|
#---
|
|
70
84
|
|
|
85
|
+
def key_cache_directory
|
|
86
|
+
File.join(build_directory, 'keys')
|
|
87
|
+
end
|
|
88
|
+
#---
|
|
89
|
+
|
|
71
90
|
def cache
|
|
72
91
|
config.cache
|
|
73
92
|
end
|
|
@@ -195,6 +214,12 @@ class Network < CORL.plugin_class(:base)
|
|
|
195
214
|
CORL.node(:test, config.export, provider)
|
|
196
215
|
end
|
|
197
216
|
|
|
217
|
+
#---
|
|
218
|
+
|
|
219
|
+
def build
|
|
220
|
+
@build
|
|
221
|
+
end
|
|
222
|
+
|
|
198
223
|
#-----------------------------------------------------------------------------
|
|
199
224
|
# Operations
|
|
200
225
|
|
|
@@ -247,7 +272,7 @@ class Network < CORL.plugin_class(:base)
|
|
|
247
272
|
def add_node(provider, name, options = {})
|
|
248
273
|
config = Config.ensure(options)
|
|
249
274
|
|
|
250
|
-
keypair = config.
|
|
275
|
+
keypair = config.get(:keypair, nil)
|
|
251
276
|
return false unless keypair && keypair.is_a?(Util::SSH::Keypair)
|
|
252
277
|
|
|
253
278
|
remote_name = config.delete(:remote, :edit)
|
|
@@ -270,11 +295,15 @@ class Network < CORL.plugin_class(:base)
|
|
|
270
295
|
yield(:preprocess, hook_config) if block_given?
|
|
271
296
|
|
|
272
297
|
if ! node.local? && node.attach_keys(keypair) && extension_check(:add_node, hook_config)
|
|
298
|
+
node.keypair = keypair
|
|
299
|
+
|
|
273
300
|
# Create new node / machine
|
|
274
301
|
success = node.create do |op, data|
|
|
275
302
|
block_given? ? yield("create_#{op}".to_sym, data) : data
|
|
276
303
|
end
|
|
277
304
|
|
|
305
|
+
remote_name = nil if remote_name && ! remote(remote_name)
|
|
306
|
+
|
|
278
307
|
if success && node.save({ :remote => remote_name, :message => "Created machine #{name} on #{provider}" })
|
|
279
308
|
success = init_node(node, config.defaults({ :bootstrap => true, :seed => true })) do |op, data|
|
|
280
309
|
block_given? ? yield(op, data) : data
|
|
@@ -335,7 +364,7 @@ class Network < CORL.plugin_class(:base)
|
|
|
335
364
|
|
|
336
365
|
if success && seed_project
|
|
337
366
|
# Seed machine with remote project reference
|
|
338
|
-
result = node.
|
|
367
|
+
result = node.node_seed({
|
|
339
368
|
:project_reference => seed_project,
|
|
340
369
|
:project_branch => seed_branch
|
|
341
370
|
}) do |op, data|
|
|
@@ -349,7 +378,7 @@ class Network < CORL.plugin_class(:base)
|
|
|
349
378
|
|
|
350
379
|
if success && provision
|
|
351
380
|
# Run configured provisioners on machine
|
|
352
|
-
result = node.
|
|
381
|
+
result = node.node_provision(config) do |op, data|
|
|
353
382
|
yield("provision_#{op}".to_sym, data)
|
|
354
383
|
end
|
|
355
384
|
success = result.status == code.success
|
data/lib/core/plugin/node.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
|
-
module
|
|
2
|
+
module CORL
|
|
3
3
|
module Plugin
|
|
4
|
-
class Node < CORL.plugin_class(:base)
|
|
4
|
+
class Node < CORL.plugin_class(:nucleon, :base)
|
|
5
5
|
|
|
6
6
|
include Parallel
|
|
7
7
|
external_block_exec :exec, :command, :action
|
|
@@ -85,19 +85,53 @@ class Node < CORL.plugin_class(:base)
|
|
|
85
85
|
|
|
86
86
|
#---
|
|
87
87
|
|
|
88
|
+
def fact_var
|
|
89
|
+
@facts
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def fact_var=facts
|
|
93
|
+
@facts = facts
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
#---
|
|
97
|
+
|
|
98
|
+
def facts(reset = false, clone = true)
|
|
99
|
+
if reset || fact_var.nil?
|
|
100
|
+
default_configs = extended_config(:hiera_default_facts, {
|
|
101
|
+
:fqdn => hostname,
|
|
102
|
+
:hostname => hostname.gsub(/\..*$/, ''),
|
|
103
|
+
:corl_provider => plugin_provider.to_s
|
|
104
|
+
})
|
|
105
|
+
self.fact_var = Config.new(lookup_facts).defaults(default_configs).export
|
|
106
|
+
end
|
|
107
|
+
return fact_var.clone if clone
|
|
108
|
+
fact_var
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
#---
|
|
112
|
+
|
|
113
|
+
def hiera_var
|
|
114
|
+
@hiera
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
def hiera_var=hiera
|
|
118
|
+
@hiera = hiera
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
#---
|
|
122
|
+
|
|
88
123
|
def hiera_override_dir
|
|
89
124
|
network.hiera_override_dir
|
|
90
125
|
end
|
|
91
126
|
|
|
92
127
|
#---
|
|
93
128
|
|
|
94
|
-
def
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
Config.new(lookup_facts).defaults(default_configs).export
|
|
129
|
+
def keypair
|
|
130
|
+
@keypair
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
def keypair=keypair
|
|
134
|
+
@keypair = keypair
|
|
101
135
|
end
|
|
102
136
|
|
|
103
137
|
#---
|
|
@@ -144,6 +178,10 @@ class Node < CORL.plugin_class(:base)
|
|
|
144
178
|
def hostname
|
|
145
179
|
hostname = setting(:hostname)
|
|
146
180
|
|
|
181
|
+
unless hostname
|
|
182
|
+
hostname = plugin_name
|
|
183
|
+
end
|
|
184
|
+
|
|
147
185
|
if hostname.to_s != ui.resource.to_s
|
|
148
186
|
ui.resource = Util::Console.colorize(hostname, @class_color)
|
|
149
187
|
logger = hostname
|
|
@@ -317,7 +355,7 @@ class Node < CORL.plugin_class(:base)
|
|
|
317
355
|
provisioner_info = {}
|
|
318
356
|
|
|
319
357
|
# Compose needed provisioners and profiles
|
|
320
|
-
profiles.each do |profile|
|
|
358
|
+
profiles.each do |profile|
|
|
321
359
|
if info = Plugin::Provisioner.translate_reference(profile)
|
|
322
360
|
provider = info[:provider]
|
|
323
361
|
|
|
@@ -377,32 +415,51 @@ class Node < CORL.plugin_class(:base)
|
|
|
377
415
|
config = Config.ensure(options)
|
|
378
416
|
success = true
|
|
379
417
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
418
|
+
# TODO: Figure out what's going on with the parallel implementation here.
|
|
419
|
+
ENV['NUCLEON_NO_PARALLEL'] = 'true'
|
|
420
|
+
|
|
421
|
+
status = parallel(:build_provider, network.builders, config)
|
|
422
|
+
success = false if status.values.include?(false)
|
|
423
|
+
|
|
424
|
+
if success
|
|
425
|
+
status = parallel(:build_provisioners, provisioners, config)
|
|
426
|
+
success = false if status.values.include?(false)
|
|
427
|
+
|
|
428
|
+
if success
|
|
429
|
+
myself.build_time = Time.now.to_s if success
|
|
385
430
|
|
|
386
|
-
|
|
387
|
-
success
|
|
388
|
-
|
|
431
|
+
if config.delete(:save, true)
|
|
432
|
+
ui.success("Saving successful build")
|
|
433
|
+
|
|
434
|
+
success = save(extended_config(:build, {
|
|
435
|
+
:message => config.get(:message, "Built #{plugin_provider} node: #{plugin_name}"),
|
|
436
|
+
:remote => config.get(:remote, :edit)
|
|
437
|
+
}))
|
|
389
438
|
end
|
|
390
439
|
end
|
|
391
440
|
end
|
|
392
441
|
|
|
393
|
-
|
|
442
|
+
ENV['NUCLEON_NO_PARALLEL'] = nil
|
|
394
443
|
|
|
395
|
-
if success && config.delete(:save, true)
|
|
396
|
-
ui.success("Saving successful build")
|
|
397
|
-
|
|
398
|
-
success = save(extended_config(:build, {
|
|
399
|
-
:message => config.get(:message, "Built #{plugin_provider} node: #{plugin_name}"),
|
|
400
|
-
:remote => config.get(:remote, :edit)
|
|
401
|
-
}))
|
|
402
|
-
end
|
|
403
444
|
success
|
|
404
445
|
end
|
|
405
446
|
|
|
447
|
+
def build_provider(provider, plugin, config)
|
|
448
|
+
ui.info("Building #{provider} components")
|
|
449
|
+
plugin.build(myself, config)
|
|
450
|
+
end
|
|
451
|
+
|
|
452
|
+
def build_provisioners(provider, collection, config)
|
|
453
|
+
ui.info("Building #{provider} provisioner collection")
|
|
454
|
+
status = parallel(:build_provisioner, collection, provider, config)
|
|
455
|
+
status.values.include?(false) ? false : true
|
|
456
|
+
end
|
|
457
|
+
|
|
458
|
+
def build_provisioner(name, plugin, provider, config)
|
|
459
|
+
ui.info("Building #{provider} #{name} provisioner components")
|
|
460
|
+
plugin.build(myself, config)
|
|
461
|
+
end
|
|
462
|
+
|
|
406
463
|
#---
|
|
407
464
|
|
|
408
465
|
def attach_keys(keypair)
|
|
@@ -424,6 +481,9 @@ class Node < CORL.plugin_class(:base)
|
|
|
424
481
|
if private_key && public_key
|
|
425
482
|
FileUtils.chmod(0600, private_key)
|
|
426
483
|
FileUtils.chmod(0644, public_key)
|
|
484
|
+
|
|
485
|
+
myself.keypair = Util::SSH.generate({ :private_key => keypair.private_key })
|
|
486
|
+
myself.keypair.store(network.key_cache_directory, plugin_name)
|
|
427
487
|
|
|
428
488
|
save_config[:files] = [ private_key, public_key ]
|
|
429
489
|
|
|
@@ -471,7 +531,7 @@ class Node < CORL.plugin_class(:base)
|
|
|
471
531
|
#---
|
|
472
532
|
|
|
473
533
|
def create_machine(name, provider, options = {})
|
|
474
|
-
CORL.create_plugin(:machine, provider, extended_config(name, options).import({ :meta => { :parent => myself }}))
|
|
534
|
+
CORL.create_plugin(:CORL, :machine, provider, extended_config(name, options).import({ :meta => { :parent => myself }}))
|
|
475
535
|
end
|
|
476
536
|
|
|
477
537
|
#---
|
|
@@ -651,7 +711,7 @@ class Node < CORL.plugin_class(:base)
|
|
|
651
711
|
end
|
|
652
712
|
results = test if test
|
|
653
713
|
|
|
654
|
-
rescue
|
|
714
|
+
rescue => error
|
|
655
715
|
default_error.append_errors(error.message)
|
|
656
716
|
end
|
|
657
717
|
else
|
|
@@ -726,7 +786,7 @@ class Node < CORL.plugin_class(:base)
|
|
|
726
786
|
|
|
727
787
|
encoded_config = Util::CLI.encode(Util::Data.clean(config.export))
|
|
728
788
|
action_config = extended_config(:action, {
|
|
729
|
-
:command => provider,
|
|
789
|
+
:command => provider.to_s.gsub('_', ' '),
|
|
730
790
|
:data => { :encoded => encoded_config }
|
|
731
791
|
})
|
|
732
792
|
|
|
@@ -792,7 +852,7 @@ class Node < CORL.plugin_class(:base)
|
|
|
792
852
|
return Util::Data.symbol_map(Util::Data.parse_json(result.output))
|
|
793
853
|
end
|
|
794
854
|
end
|
|
795
|
-
local? ? facts : custom_facts
|
|
855
|
+
local? ? Util::Data.merge([ CORL.facts, custom_facts ]) : custom_facts
|
|
796
856
|
end
|
|
797
857
|
|
|
798
858
|
#---
|
|
@@ -801,13 +861,13 @@ class Node < CORL.plugin_class(:base)
|
|
|
801
861
|
if ! local? && bootstrap_script
|
|
802
862
|
config = Config.ensure(options).import({ :property => property })
|
|
803
863
|
result = run.lookup(config)
|
|
804
|
-
|
|
864
|
+
|
|
805
865
|
if result.status == code.success
|
|
806
866
|
return Util::Data.value(Util::Data.parse_json(result.output), default)
|
|
807
867
|
end
|
|
808
868
|
return default
|
|
809
869
|
end
|
|
810
|
-
options[:hiera_scope] = Util::Data.prefix('::',
|
|
870
|
+
options[:hiera_scope] = Util::Data.prefix('::', facts, '')
|
|
811
871
|
lookup(property, default, options)
|
|
812
872
|
end
|
|
813
873
|
|
|
@@ -1138,9 +1198,9 @@ class Node < CORL.plugin_class(:base)
|
|
|
1138
1198
|
#-----------------------------------------------------------------------------
|
|
1139
1199
|
# Utilities
|
|
1140
1200
|
|
|
1141
|
-
def self.build_info(
|
|
1201
|
+
def self.build_info(namespace, plugin_type, data)
|
|
1142
1202
|
data = data.split(/\s*,\s*/) if data.is_a?(String)
|
|
1143
|
-
super(
|
|
1203
|
+
super(namespace, plugin_type, data)
|
|
1144
1204
|
end
|
|
1145
1205
|
|
|
1146
1206
|
#---
|