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
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
|
|
2
|
+
module CORL
|
|
3
|
+
module Builder
|
|
4
|
+
class Package < CORL.plugin_class(:CORL, :builder)
|
|
5
|
+
|
|
6
|
+
#-----------------------------------------------------------------------------
|
|
7
|
+
# Package plugin interface
|
|
8
|
+
|
|
9
|
+
def normalize(reload)
|
|
10
|
+
super do
|
|
11
|
+
@packages = {}
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
#-----------------------------------------------------------------------------
|
|
16
|
+
# Property accessors / modifiers
|
|
17
|
+
|
|
18
|
+
def build_directory
|
|
19
|
+
File.join(network.build_directory, 'packages')
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
#---
|
|
23
|
+
|
|
24
|
+
def packages
|
|
25
|
+
@packages
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def set_package(name, directory)
|
|
29
|
+
@packages[name] = directory
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
#-----------------------------------------------------------------------------
|
|
33
|
+
# Package interface operations
|
|
34
|
+
|
|
35
|
+
def build_provider(name, project_reference, environment)
|
|
36
|
+
provider_id = id(name)
|
|
37
|
+
directory = File.join(internal_path(build_directory), provider_id.to_s)
|
|
38
|
+
success = true
|
|
39
|
+
|
|
40
|
+
ui.info("Building package #{blue(name)} at #{purple(project_reference)} into #{green(directory)}")
|
|
41
|
+
|
|
42
|
+
full_directory = File.join(network.directory, directory)
|
|
43
|
+
|
|
44
|
+
unless packages.has_key?(provider_id)
|
|
45
|
+
project = build_config.manage(:configuration, extended_config(:package, {
|
|
46
|
+
:directory => full_directory,
|
|
47
|
+
:url => project_reference,
|
|
48
|
+
:create => File.directory?(full_directory) ? false : true,
|
|
49
|
+
:manage_ignore => false
|
|
50
|
+
}))
|
|
51
|
+
unless project
|
|
52
|
+
ui.warn("Package #{cyan(name)} failed to initialize")
|
|
53
|
+
success = false
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
if success
|
|
57
|
+
set_package(provider_id, full_directory)
|
|
58
|
+
|
|
59
|
+
build_config.import(project)
|
|
60
|
+
build_config.set_location(plugin_provider, name, directory)
|
|
61
|
+
|
|
62
|
+
if project.get([ :builders, plugin_provider ], false)
|
|
63
|
+
sub_packages = process_environment(project.get_hash([ :builders, plugin_provider ]), environment)
|
|
64
|
+
|
|
65
|
+
status = parallel(:build_provider, sub_packages, environment)
|
|
66
|
+
success = false if status.values.include?(false)
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
ui.success("Build of package #{blue(name)} finished") if success
|
|
71
|
+
success
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
module CORL
|
|
3
3
|
module Configuration
|
|
4
|
-
class File < CORL.plugin_class(:configuration)
|
|
4
|
+
class File < CORL.plugin_class(:CORL, :configuration)
|
|
5
5
|
|
|
6
6
|
#-----------------------------------------------------------------------------
|
|
7
7
|
# Configuration plugin interface
|
|
@@ -84,7 +84,7 @@ class File < CORL.plugin_class(:configuration)
|
|
|
84
84
|
|
|
85
85
|
def separate
|
|
86
86
|
file_data = Config.new
|
|
87
|
-
default_provider = CORL.type_default(:translator)
|
|
87
|
+
default_provider = CORL.type_default(:nucleon, :translator)
|
|
88
88
|
|
|
89
89
|
split_config = lambda do |properties, local_router, parents = []|
|
|
90
90
|
properties.each do |name, value|
|
|
@@ -234,7 +234,7 @@ class File < CORL.plugin_class(:configuration)
|
|
|
234
234
|
begin
|
|
235
235
|
FileUtils.mkdir_p(attach_path) unless Dir.exists?(attach_path)
|
|
236
236
|
|
|
237
|
-
rescue
|
|
237
|
+
rescue => error
|
|
238
238
|
alert(error.message)
|
|
239
239
|
success = false
|
|
240
240
|
end
|
|
@@ -258,7 +258,7 @@ class File < CORL.plugin_class(:configuration)
|
|
|
258
258
|
FileUtils.mkdir_p(attach_path) unless Dir.exists?(attach_path)
|
|
259
259
|
FileUtils.cp(file, new_file)
|
|
260
260
|
|
|
261
|
-
rescue
|
|
261
|
+
rescue => error
|
|
262
262
|
alert(error.message)
|
|
263
263
|
success = false
|
|
264
264
|
end
|
|
@@ -318,7 +318,7 @@ class File < CORL.plugin_class(:configuration)
|
|
|
318
318
|
logger.debug("Clearing configuration file information")
|
|
319
319
|
search.clear
|
|
320
320
|
else
|
|
321
|
-
translators = CORL.loaded_plugins(:translator)
|
|
321
|
+
translators = CORL.loaded_plugins(:nucleon, :translator)
|
|
322
322
|
file_bases = [ "corl", extension_collect(:base) ].flatten
|
|
323
323
|
|
|
324
324
|
project.localize do
|
data/lib/CORL/machine/vagrant.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
module CORL
|
|
3
3
|
module Machine
|
|
4
|
-
class Vagrant < CORL.plugin_class(:machine)
|
|
4
|
+
class Vagrant < CORL.plugin_class(:CORL, :machine)
|
|
5
5
|
|
|
6
6
|
include Mixin::Machine::SSH
|
|
7
7
|
|
|
@@ -140,7 +140,7 @@ class Vagrant < CORL.plugin_class(:machine)
|
|
|
140
140
|
def reload(options = {})
|
|
141
141
|
super do |config|
|
|
142
142
|
success = run(:reload, config)
|
|
143
|
-
success = init_ssh_session(true, config.get(:tries,
|
|
143
|
+
success = init_ssh_session(true, config.get(:tries, 12), config.get(:sleep_time, 5)) if success
|
|
144
144
|
end
|
|
145
145
|
end
|
|
146
146
|
|
data/lib/CORL/node/local.rb
CHANGED
data/lib/CORL/node/vagrant.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
module CORL
|
|
3
3
|
module Node
|
|
4
|
-
class Vagrant < CORL.plugin_class(:node)
|
|
4
|
+
class Vagrant < CORL.plugin_class(:CORL, :node)
|
|
5
5
|
|
|
6
6
|
#-----------------------------------------------------------------------------
|
|
7
7
|
# Node plugin interface
|
|
@@ -227,10 +227,15 @@ class Vagrant < CORL.plugin_class(:node)
|
|
|
227
227
|
if data.include?('stdin: is not a tty') || data.include?('unable to re-open stdin')
|
|
228
228
|
data = ''
|
|
229
229
|
end
|
|
230
|
+
elsif type == :output
|
|
231
|
+
# Hide redundant Facter output
|
|
232
|
+
if data =~ /^Already evaluated [a-z]+ at [^,]+, reevaluating anyways$/
|
|
233
|
+
data = ''
|
|
234
|
+
end
|
|
230
235
|
end
|
|
231
236
|
data
|
|
232
237
|
end
|
|
233
|
-
|
|
238
|
+
|
|
234
239
|
#-----------------------------------------------------------------------------
|
|
235
240
|
# Machine type utilities
|
|
236
241
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
|
|
1
2
|
module CORL
|
|
2
3
|
module Provisioner
|
|
3
|
-
class Puppetnode < CORL.plugin_class(:provisioner)
|
|
4
|
+
class Puppetnode < CORL.plugin_class(:CORL, :provisioner)
|
|
4
5
|
|
|
5
6
|
@@puppet_lock = Mutex.new
|
|
6
7
|
|
|
@@ -12,6 +13,16 @@ class Puppetnode < CORL.plugin_class(:provisioner)
|
|
|
12
13
|
@@status
|
|
13
14
|
end
|
|
14
15
|
|
|
16
|
+
#---
|
|
17
|
+
|
|
18
|
+
def self.network
|
|
19
|
+
@@network
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def self.node
|
|
23
|
+
@@node
|
|
24
|
+
end
|
|
25
|
+
|
|
15
26
|
#-----------------------------------------------------------------------------
|
|
16
27
|
# Provisioner plugin interface
|
|
17
28
|
|
|
@@ -72,124 +83,107 @@ class Puppetnode < CORL.plugin_class(:provisioner)
|
|
|
72
83
|
|
|
73
84
|
#-----------------------------------------------------------------------------
|
|
74
85
|
# Puppet initialization
|
|
86
|
+
|
|
87
|
+
def init_puppet(node, profiles)
|
|
88
|
+
Puppet.initialize_settings
|
|
75
89
|
|
|
76
|
-
|
|
77
|
-
locations
|
|
90
|
+
apply_environment = nil
|
|
91
|
+
locations = build_locations(node)
|
|
78
92
|
|
|
79
|
-
|
|
80
|
-
|
|
93
|
+
environment, environment_directory = ensure_environment(node)
|
|
94
|
+
|
|
95
|
+
Puppet::Util::Log.newdestination(id)
|
|
96
|
+
Puppet::Transaction::Report.indirection.cache_class = :yaml
|
|
81
97
|
|
|
82
|
-
|
|
83
|
-
# environment without phantom empty environment issues.
|
|
98
|
+
Puppet[:graph] = true if CORL.log_level == :error
|
|
84
99
|
|
|
85
|
-
Puppet[:
|
|
100
|
+
Puppet[:node_terminus] = :plain
|
|
101
|
+
Puppet[:data_binding_terminus] = :corl
|
|
86
102
|
Puppet[:default_file_terminus] = :file_server
|
|
87
|
-
Puppet[:node_name_value] = id.to_s
|
|
88
103
|
|
|
89
104
|
unless profiles.empty?
|
|
90
105
|
modulepath = profiles.collect do |profile|
|
|
91
|
-
File.join(
|
|
92
|
-
|
|
93
|
-
|
|
106
|
+
profile_directory = File.join(network.directory, locations[:puppet_module][profile.to_sym])
|
|
107
|
+
File.directory?(profile_directory) ? profile_directory : nil
|
|
108
|
+
end.compact
|
|
94
109
|
end
|
|
95
110
|
|
|
96
111
|
if manifest = gateway
|
|
97
112
|
if manifest.match(/^packages\/.*/)
|
|
98
|
-
manifest = File.join(build_directory,
|
|
113
|
+
manifest = File.join(network.build_directory, manifest)
|
|
99
114
|
else
|
|
100
115
|
manifest = File.join(network.directory, directory, manifest)
|
|
101
116
|
end
|
|
102
|
-
Puppet[:manifest] = manifest
|
|
103
117
|
end
|
|
104
118
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
register
|
|
108
|
-
node
|
|
119
|
+
Puppet[:environment] = environment
|
|
120
|
+
Puppet::Node::Environment.create(environment.to_sym, modulepath, manifest)
|
|
109
121
|
end
|
|
110
122
|
protected :init_puppet
|
|
111
|
-
|
|
123
|
+
|
|
112
124
|
#---
|
|
113
125
|
|
|
114
|
-
def
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
end
|
|
122
|
-
node
|
|
126
|
+
def get_puppet_node(environment)
|
|
127
|
+
Puppet[:node_name_value] = id.to_s
|
|
128
|
+
|
|
129
|
+
puppet_node = Puppet::Node.indirection.find(id.to_s, :environment => environment)
|
|
130
|
+
|
|
131
|
+
puppet_node.merge(string_map(@@node.facts))
|
|
132
|
+
puppet_node
|
|
123
133
|
end
|
|
124
|
-
protected :
|
|
134
|
+
protected :get_puppet_node
|
|
125
135
|
|
|
126
136
|
#-----------------------------------------------------------------------------
|
|
127
137
|
# Provisioner interface operations
|
|
128
138
|
|
|
129
|
-
def
|
|
130
|
-
super do |
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
locations[:module] = {}
|
|
135
|
-
|
|
136
|
-
init_profile = lambda do |package_name, profile_name, profile_info|
|
|
137
|
-
package_id = id(package_name)
|
|
138
|
-
base_directory = File.join(locations[:build], 'modules', package_id.to_s, profile_name.to_s)
|
|
139
|
-
profile_success = true
|
|
139
|
+
def build_profile(name, info, package, environment, profiles)
|
|
140
|
+
super do |processed_info|
|
|
141
|
+
package_id = id(package)
|
|
142
|
+
directory = File.join(internal_path(build_directory), package_id.to_s, name.to_s)
|
|
143
|
+
success = true
|
|
140
144
|
|
|
141
|
-
|
|
145
|
+
ui.info("Building CORL profile #{blue(name)} modules into #{green(directory)}")
|
|
146
|
+
|
|
147
|
+
if processed_info.has_key?(:modules)
|
|
148
|
+
status = parallel(:build_module, hash(processed_info[:modules]), directory, name, environment)
|
|
149
|
+
success = status.values.include?(false) ? false : true
|
|
142
150
|
|
|
143
|
-
|
|
144
|
-
profile_info[:modules].each do |module_name, module_reference|
|
|
145
|
-
module_directory = File.join(base_directory, module_name.to_s)
|
|
146
|
-
|
|
147
|
-
ui.info("Building Puppet module #{blue(module_name)} at #{purple(module_reference)} into #{green(module_directory)}")
|
|
148
|
-
|
|
149
|
-
full_module_directory = File.join(build_directory, module_directory)
|
|
150
|
-
|
|
151
|
-
module_project = CORL.project(extended_config(:puppet_module, {
|
|
152
|
-
:directory => full_module_directory,
|
|
153
|
-
:url => module_reference,
|
|
154
|
-
:create => File.directory?(full_module_directory) ? false : true,
|
|
155
|
-
:pull => true
|
|
156
|
-
}))
|
|
157
|
-
unless module_project
|
|
158
|
-
ui.warn("Puppet module #{cyan(module_name)} failed to initialize")
|
|
159
|
-
profile_success = false
|
|
160
|
-
break
|
|
161
|
-
end
|
|
162
|
-
end
|
|
163
|
-
locations[:module][profile_id(package_name, profile_name)] = base_directory if profile_success
|
|
164
|
-
profile_success
|
|
165
|
-
end
|
|
166
|
-
end
|
|
167
|
-
|
|
168
|
-
hash(package_info.get([ :provisioners, plugin_provider ])).each do |package_name, info|
|
|
169
|
-
if info.has_key?(:profiles)
|
|
170
|
-
info[:profiles].each do |profile_name, profile_info|
|
|
171
|
-
unless init_profile.call(package_name, profile_name, profile_info)
|
|
172
|
-
success = false
|
|
173
|
-
break
|
|
174
|
-
end
|
|
175
|
-
end
|
|
176
|
-
end
|
|
177
|
-
end
|
|
178
|
-
profiles.each do |profile_name, profile_info|
|
|
179
|
-
unless init_profile.call(plugin_name, profile_name, profile_info)
|
|
180
|
-
success = false
|
|
181
|
-
break
|
|
182
|
-
end
|
|
151
|
+
build_config.set_location(:puppet_module, profile_id(package, name), directory) if success
|
|
183
152
|
end
|
|
153
|
+
ui.success("Build of profile #{blue(name)} finished") if success
|
|
184
154
|
success
|
|
185
155
|
end
|
|
186
156
|
end
|
|
187
157
|
|
|
158
|
+
def build_module(name, project_reference, directory, profile, environment)
|
|
159
|
+
module_directory = File.join(directory, name.to_s)
|
|
160
|
+
full_module_directory = File.join(network.directory, module_directory)
|
|
161
|
+
module_project = nil
|
|
162
|
+
success = true
|
|
163
|
+
|
|
164
|
+
ui.info("Building #{blue(profile)} Puppet module #{blue(name)} at #{purple(project_reference)} into #{green(module_directory)}")
|
|
165
|
+
|
|
166
|
+
module_project = build_config.manage(:project, extended_config(:puppet_module, {
|
|
167
|
+
:directory => full_module_directory,
|
|
168
|
+
:url => project_reference,
|
|
169
|
+
:create => File.directory?(full_module_directory) ? false : true,
|
|
170
|
+
:pull => true,
|
|
171
|
+
:internal_ip => CORL.public_ip, # Needed for seeding Vagrant VMs
|
|
172
|
+
:manage_ignore => false
|
|
173
|
+
}))
|
|
174
|
+
unless module_project
|
|
175
|
+
ui.warn("Puppet module #{cyan(name)} failed to initialize")
|
|
176
|
+
success = false
|
|
177
|
+
end
|
|
178
|
+
ui.success("Build of #{blue(profile)} #{blue(name)} finished") if success
|
|
179
|
+
success
|
|
180
|
+
end
|
|
181
|
+
|
|
188
182
|
#---
|
|
189
183
|
|
|
190
184
|
def lookup(property, default = nil, options = {})
|
|
191
185
|
Util::Puppet.lookup(property, default, Config.ensure(options).defaults({
|
|
192
|
-
:provisioner
|
|
186
|
+
:provisioner => :puppetnode,
|
|
193
187
|
:puppet_scope => scope
|
|
194
188
|
}))
|
|
195
189
|
end
|
|
@@ -198,7 +192,7 @@ class Puppetnode < CORL.plugin_class(:provisioner)
|
|
|
198
192
|
|
|
199
193
|
def import(files, options = {})
|
|
200
194
|
Util::Puppet.import(files, Config.ensure(options).defaults({
|
|
201
|
-
:puppet_scope
|
|
195
|
+
:puppet_scope => scope,
|
|
202
196
|
:puppet_import_base => network.directory
|
|
203
197
|
}))
|
|
204
198
|
end
|
|
@@ -211,18 +205,18 @@ class Puppetnode < CORL.plugin_class(:provisioner)
|
|
|
211
205
|
|
|
212
206
|
#---
|
|
213
207
|
|
|
214
|
-
def provision(profiles, options = {})
|
|
215
|
-
super do |config|
|
|
216
|
-
locations = build_locations
|
|
217
|
-
success
|
|
208
|
+
def provision(node, profiles, options = {})
|
|
209
|
+
super do |processed_profiles, config|
|
|
210
|
+
locations = build_locations(node)
|
|
211
|
+
success = true
|
|
218
212
|
|
|
219
213
|
include_location = lambda do |type, parameters = {}, add_search_path = false|
|
|
220
214
|
classes = {}
|
|
221
215
|
|
|
222
216
|
locations[:package].each do |name, package_directory|
|
|
223
|
-
type_gateway = File.join(
|
|
224
|
-
resource_name =
|
|
225
|
-
|
|
217
|
+
type_gateway = File.join(network.directory, package_directory, "#{type}.pp")
|
|
218
|
+
resource_name = resource([ name, type ])
|
|
219
|
+
|
|
226
220
|
add_search_path(type, resource_name) if add_search_path
|
|
227
221
|
|
|
228
222
|
if File.exists?(type_gateway)
|
|
@@ -230,16 +224,16 @@ class Puppetnode < CORL.plugin_class(:provisioner)
|
|
|
230
224
|
classes[resource_name] = parameters
|
|
231
225
|
end
|
|
232
226
|
|
|
233
|
-
type_directory = File.join(
|
|
227
|
+
type_directory = File.join(network.directory, package_directory, type.to_s)
|
|
234
228
|
Dir.glob(File.join(type_directory, '*.pp')).each do |file|
|
|
235
|
-
resource_name =
|
|
229
|
+
resource_name = resource([ name, type, File.basename(file).gsub('.pp', '') ])
|
|
236
230
|
import(file)
|
|
237
231
|
classes[resource_name] = parameters
|
|
238
232
|
end
|
|
239
233
|
end
|
|
240
234
|
|
|
241
235
|
type_gateway = File.join(directory, "#{type}.pp")
|
|
242
|
-
resource_name =
|
|
236
|
+
resource_name = resource([ plugin_name, type ])
|
|
243
237
|
|
|
244
238
|
add_search_path(type, resource_name) if add_search_path
|
|
245
239
|
|
|
@@ -252,57 +246,69 @@ class Puppetnode < CORL.plugin_class(:provisioner)
|
|
|
252
246
|
|
|
253
247
|
if File.directory?(type_directory)
|
|
254
248
|
Dir.glob(File.join(type_directory, '*.pp')).each do |file|
|
|
255
|
-
resource_name =
|
|
249
|
+
resource_name = resource([ plugin_name, type, File.basename(file).gsub('.pp', '') ])
|
|
256
250
|
import(file)
|
|
257
251
|
classes[resource_name] = parameters
|
|
258
252
|
end
|
|
259
253
|
end
|
|
260
254
|
classes
|
|
261
255
|
end
|
|
262
|
-
|
|
256
|
+
|
|
263
257
|
@@puppet_lock.synchronize do
|
|
264
258
|
begin
|
|
265
259
|
ui.info("Starting catalog generation")
|
|
266
260
|
|
|
267
261
|
@@status[id] = code.success
|
|
262
|
+
@@network = network
|
|
263
|
+
@@node = node
|
|
268
264
|
|
|
269
|
-
start_time
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
265
|
+
start_time = Time.now
|
|
266
|
+
apply_environment = init_puppet(node, processed_profiles)
|
|
267
|
+
|
|
268
|
+
Puppet.override(:environments => Puppet::Environments::Static.new(apply_environment)) do
|
|
269
|
+
puppet_node = get_puppet_node(apply_environment.name)
|
|
270
|
+
@compiler = Puppet::Parser::Compiler.new(puppet_node)
|
|
271
|
+
|
|
272
|
+
# Register Puppet module plugins
|
|
273
|
+
register
|
|
274
|
+
|
|
275
|
+
# Include defaults
|
|
276
|
+
classes = include_location.call(:default, {}, true)
|
|
274
277
|
|
|
275
|
-
|
|
276
|
-
|
|
278
|
+
# Import needed profiles
|
|
279
|
+
include_location.call(:profiles, {}, false)
|
|
277
280
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
281
|
+
processed_profiles.each do |profile|
|
|
282
|
+
classes[profile.to_s] = { :require => 'Anchor[profile_start]' }
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
puppet_node.classes = classes
|
|
286
|
+
|
|
287
|
+
# Compile catalog
|
|
288
|
+
compiler.compile
|
|
289
|
+
|
|
290
|
+
catalog = compiler.catalog.to_ral
|
|
291
|
+
catalog.finalize
|
|
292
|
+
catalog.retrieval_duration = Time.now - start_time
|
|
293
|
+
|
|
294
|
+
unless config.get(:dry_run, false)
|
|
295
|
+
ui.info("\n", { :prefix => false })
|
|
296
|
+
ui.info("Starting configuration run")
|
|
297
|
+
|
|
298
|
+
# Configure the machine
|
|
299
|
+
configurer = Puppet::Configurer.new
|
|
300
|
+
if ! configurer.run(:catalog => catalog, :pluginsync => false)
|
|
301
|
+
success = false
|
|
302
|
+
end
|
|
298
303
|
end
|
|
299
304
|
end
|
|
300
305
|
|
|
301
306
|
rescue Exception => error
|
|
302
|
-
raise error
|
|
303
307
|
Puppet.log_exception(error)
|
|
308
|
+
raise error
|
|
304
309
|
end
|
|
305
310
|
end
|
|
311
|
+
|
|
306
312
|
success = false if @@status[id] != code.success
|
|
307
313
|
success
|
|
308
314
|
end
|
|
@@ -311,15 +317,17 @@ class Puppetnode < CORL.plugin_class(:provisioner)
|
|
|
311
317
|
#-----------------------------------------------------------------------------
|
|
312
318
|
# Utilities
|
|
313
319
|
|
|
314
|
-
def
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
320
|
+
def ensure_environment(node)
|
|
321
|
+
base_directory = Puppet[:environmentpath]
|
|
322
|
+
environment = node.lookup(:corl_environment)
|
|
323
|
+
env_directory = File.join(base_directory, environment)
|
|
324
|
+
|
|
325
|
+
FileUtils.mkdir_p(env_directory)
|
|
326
|
+
FileUtils.mkdir_p(File.join(env_directory, 'manifests'))
|
|
327
|
+
FileUtils.mkdir_p(File.join(env_directory, 'modules'))
|
|
328
|
+
[ environment, env_directory ]
|
|
322
329
|
end
|
|
330
|
+
protected :ensure_environment
|
|
323
331
|
end
|
|
324
332
|
end
|
|
325
333
|
end
|