corl 0.5.1 → 0.5.2
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 +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
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
module Nucleon
|
|
3
3
|
module Action
|
|
4
4
|
module Cloud
|
|
5
|
-
class Config <
|
|
6
|
-
|
|
7
|
-
include Mixin::Action::Registration
|
|
5
|
+
class Config < Nucleon.plugin_class(:nucleon, :cloud_action)
|
|
8
6
|
|
|
9
7
|
#-----------------------------------------------------------------------------
|
|
10
8
|
# Info
|
|
@@ -22,14 +20,15 @@ class Config < CORL.plugin_class(:nucleon, :cloud_action)
|
|
|
22
20
|
:configuration_save_failed,
|
|
23
21
|
:configuration_delete_failed
|
|
24
22
|
|
|
25
|
-
register_str :name
|
|
23
|
+
register_str :name
|
|
26
24
|
register_array :value
|
|
27
25
|
|
|
26
|
+
register_bool :array
|
|
28
27
|
register_bool :delete
|
|
29
28
|
register_bool :append
|
|
30
29
|
|
|
31
30
|
register_translator :input_format
|
|
32
|
-
register_translator :
|
|
31
|
+
register_translator :save_format
|
|
33
32
|
register_translator :format, :json
|
|
34
33
|
end
|
|
35
34
|
end
|
|
@@ -37,7 +36,7 @@ class Config < CORL.plugin_class(:nucleon, :cloud_action)
|
|
|
37
36
|
#---
|
|
38
37
|
|
|
39
38
|
def ignore
|
|
40
|
-
|
|
39
|
+
node_ignore
|
|
41
40
|
end
|
|
42
41
|
|
|
43
42
|
def arguments
|
|
@@ -48,24 +47,24 @@ class Config < CORL.plugin_class(:nucleon, :cloud_action)
|
|
|
48
47
|
# Operations
|
|
49
48
|
|
|
50
49
|
def execute
|
|
51
|
-
super do |node
|
|
52
|
-
ensure_network
|
|
53
|
-
config_info = parse_config_reference(
|
|
50
|
+
super do |node|
|
|
51
|
+
ensure_network do
|
|
52
|
+
config_info = parse_config_reference(node, settings[:name])
|
|
54
53
|
|
|
55
54
|
unless config_info
|
|
56
55
|
myself.status = code.configuration_parse_failed
|
|
57
56
|
end
|
|
58
57
|
|
|
59
|
-
if
|
|
60
|
-
|
|
58
|
+
if settings.delete(:delete, false)
|
|
59
|
+
delete_config_property(config_info)
|
|
60
|
+
|
|
61
|
+
elsif config_info[:property].nil?
|
|
62
|
+
render_config_properties(config_info)
|
|
61
63
|
|
|
62
|
-
elsif settings.delete(:delete, false)
|
|
63
|
-
delete_config_property(network, config_info, sanitize_remote(network, settings[:net_remote]))
|
|
64
|
-
|
|
65
64
|
elsif ! settings[:value].empty?
|
|
66
|
-
set_config_property(
|
|
65
|
+
set_config_property(config_info, settings[:value])
|
|
67
66
|
else
|
|
68
|
-
render_config_property(
|
|
67
|
+
render_config_property(config_info)
|
|
69
68
|
end
|
|
70
69
|
end
|
|
71
70
|
end
|
|
@@ -74,12 +73,14 @@ class Config < CORL.plugin_class(:nucleon, :cloud_action)
|
|
|
74
73
|
#-----------------------------------------------------------------------------
|
|
75
74
|
# Sub operations
|
|
76
75
|
|
|
77
|
-
def render_config_properties(
|
|
78
|
-
if file_labels = config_info[:
|
|
79
|
-
info(
|
|
76
|
+
def render_config_properties(config_info)
|
|
77
|
+
if file_labels = config_info[:rendered_files]
|
|
78
|
+
info('subconfigurations', { :prefix => false })
|
|
79
|
+
info("\n", { :i18n => false })
|
|
80
80
|
file_labels.each do |label|
|
|
81
|
-
info
|
|
82
|
-
end
|
|
81
|
+
prefixed_message(:info, ' ', label, { :i18n => false, :prefix => false })
|
|
82
|
+
end
|
|
83
|
+
info("\n", { :i18n => false })
|
|
83
84
|
else
|
|
84
85
|
format = settings[:format]
|
|
85
86
|
myself.result = config_info[:config].export
|
|
@@ -89,7 +90,7 @@ class Config < CORL.plugin_class(:nucleon, :cloud_action)
|
|
|
89
90
|
|
|
90
91
|
#---
|
|
91
92
|
|
|
92
|
-
def render_config_property(
|
|
93
|
+
def render_config_property(config_info)
|
|
93
94
|
format = settings[:format]
|
|
94
95
|
myself.result = config_info[:value]
|
|
95
96
|
render result, :format => format
|
|
@@ -97,44 +98,65 @@ class Config < CORL.plugin_class(:nucleon, :cloud_action)
|
|
|
97
98
|
|
|
98
99
|
#---
|
|
99
100
|
|
|
100
|
-
def delete_config_property(
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
def delete_config_property(config_info)
|
|
102
|
+
remote_text = remote_message(settings[:net_remote])
|
|
103
|
+
config_file = config_info[:file].sub(network.directory + File::SEPARATOR, '')
|
|
104
|
+
render_options = { :config_file => blue(config_file), :remote_text => yellow(remote_text) }
|
|
105
|
+
success = false
|
|
106
|
+
|
|
107
|
+
if config_info[:property]
|
|
108
|
+
name = parse_property_name(config_info[:property])
|
|
109
|
+
render_options.merge({ :name => blue(name) })
|
|
104
110
|
|
|
105
|
-
|
|
111
|
+
config_info[:config].delete(config_info[:property])
|
|
106
112
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
success("Configuration `#{blue(name)}` deleted (#{yellow(remote_text)})", { :i18n => false })
|
|
113
|
+
if File.exists?(config_info[:file])
|
|
114
|
+
if Util::Disk.write(config_info[:file], config_info[:translator].generate(config_info[:config].export))
|
|
115
|
+
success = true
|
|
111
116
|
else
|
|
112
|
-
error(
|
|
113
|
-
myself.status = code.configuration_save_failed
|
|
117
|
+
error('file_save', render_options)
|
|
118
|
+
myself.status = code.configuration_save_failed
|
|
114
119
|
end
|
|
115
120
|
else
|
|
116
|
-
|
|
117
|
-
myself.status = code.configuration_save_failed
|
|
121
|
+
info('no_config_file', render_options)
|
|
118
122
|
end
|
|
119
123
|
else
|
|
120
|
-
|
|
124
|
+
if File.exists?(config_info[:file])
|
|
125
|
+
if FileUtils.rm(config_info[:file])
|
|
126
|
+
success = true
|
|
127
|
+
else
|
|
128
|
+
error('file_remove', render_options)
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
if success
|
|
134
|
+
if network.save({ :files => config_file, :remote => settings[:net_remote], :message => "Deleting configuration #{name} from #{config_file}", :allow_empty => true })
|
|
135
|
+
success('delete', render_options)
|
|
136
|
+
else
|
|
137
|
+
error('delete', render_options)
|
|
138
|
+
myself.status = code.configuration_save_failed
|
|
139
|
+
end
|
|
121
140
|
end
|
|
122
141
|
end
|
|
123
142
|
|
|
124
143
|
#---
|
|
125
144
|
|
|
126
|
-
def set_config_property(
|
|
127
|
-
name
|
|
128
|
-
remote_text
|
|
145
|
+
def set_config_property(config_info, values)
|
|
146
|
+
name = parse_property_name(config_info[:property])
|
|
147
|
+
remote_text = remote_message(settings[:net_remote])
|
|
148
|
+
config_file = config_info[:file].sub(network.directory + File::SEPARATOR, '')
|
|
149
|
+
|
|
150
|
+
render_options = { :config_file => blue(config_file), :name => blue(name), :remote_text => yellow(remote_text) }
|
|
129
151
|
|
|
130
152
|
config_file = config_info[:file].sub(network.directory + File::SEPARATOR, '')
|
|
131
153
|
input_format = settings[:input_format]
|
|
132
154
|
|
|
133
|
-
values.each_with_index do |value, index|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
155
|
+
values.each_with_index do |value, index|
|
|
156
|
+
if input_format
|
|
157
|
+
translator = CORL.translator({}, input_format)
|
|
158
|
+
values[index] = translator.parse(value)
|
|
159
|
+
end
|
|
138
160
|
values[index] = Util::Data.value(values[index])
|
|
139
161
|
end
|
|
140
162
|
|
|
@@ -148,7 +170,9 @@ class Config < CORL.plugin_class(:nucleon, :cloud_action)
|
|
|
148
170
|
values = prev_value
|
|
149
171
|
end
|
|
150
172
|
else
|
|
151
|
-
if
|
|
173
|
+
if settings[:array]
|
|
174
|
+
values = array(values)
|
|
175
|
+
elsif values.size == 1
|
|
152
176
|
values = values[0]
|
|
153
177
|
end
|
|
154
178
|
end
|
|
@@ -159,14 +183,14 @@ class Config < CORL.plugin_class(:nucleon, :cloud_action)
|
|
|
159
183
|
FileUtils.mkdir_p(File.dirname(config_info[:file]))
|
|
160
184
|
|
|
161
185
|
if Util::Disk.write(config_info[:file], config_info[:translator].generate(config_info[:config].export))
|
|
162
|
-
if network.save({ :files => config_file, :remote =>
|
|
163
|
-
success(
|
|
186
|
+
if network.save({ :files => config_file, :remote => settings[:net_remote], :message => "Updating configuration #{name} in #{config_file}", :allow_empty => true })
|
|
187
|
+
success('update', render_options)
|
|
164
188
|
else
|
|
165
|
-
error(
|
|
189
|
+
error('update', render_options)
|
|
166
190
|
myself.status = code.configuration_save_failed
|
|
167
191
|
end
|
|
168
192
|
else
|
|
169
|
-
error(
|
|
193
|
+
error('file_save', render_options)
|
|
170
194
|
myself.status = code.configuration_save_failed
|
|
171
195
|
end
|
|
172
196
|
end
|
|
@@ -174,10 +198,13 @@ class Config < CORL.plugin_class(:nucleon, :cloud_action)
|
|
|
174
198
|
#-----------------------------------------------------------------------------
|
|
175
199
|
# Utilities
|
|
176
200
|
|
|
177
|
-
def parse_config_reference(
|
|
178
|
-
|
|
179
|
-
|
|
201
|
+
def parse_config_reference(node, name)
|
|
202
|
+
# @TODO: Break this method up, URGENTLY, before it gets too hideous
|
|
203
|
+
# Oh wait, it's already too hideous
|
|
180
204
|
|
|
205
|
+
info = {}
|
|
206
|
+
data = {}
|
|
207
|
+
config = CORL::Config.new({}, {}, true, false)
|
|
181
208
|
translators = CORL.loaded_plugins(:nucleon, :translator).keys
|
|
182
209
|
|
|
183
210
|
# common@php::apache::memory_limit
|
|
@@ -187,28 +214,54 @@ class Config < CORL.plugin_class(:nucleon, :cloud_action)
|
|
|
187
214
|
config_elements = name.split('@')
|
|
188
215
|
|
|
189
216
|
property = config_elements.size > 1 ? config_elements.pop : nil
|
|
190
|
-
config_elements = config_elements[0].split('/')
|
|
217
|
+
config_elements = config_elements[0].split('/') if config_elements.size > 0
|
|
191
218
|
config_file_name = config_elements.pop
|
|
192
219
|
config_path = File.join(network.config_directory, *config_elements)
|
|
193
|
-
|
|
220
|
+
config_dir = config_file_name ? File.join(config_path, config_file_name) : config_path
|
|
221
|
+
config_file = nil
|
|
222
|
+
config_files = nil
|
|
223
|
+
translator = []
|
|
224
|
+
|
|
194
225
|
if config_file_name
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
226
|
+
property = property.gsub(/\]$/, '').split(/\]?\[/) if property
|
|
227
|
+
|
|
228
|
+
translators.each do |translator_name|
|
|
229
|
+
config_file = File.join(config_path, "#{config_file_name}." + translator_name.to_s)
|
|
230
|
+
|
|
231
|
+
if File.exists?(config_file)
|
|
232
|
+
unless data = Util::Disk.read(config_file)
|
|
233
|
+
error('file_read', { :config_file => config_file })
|
|
234
|
+
return nil
|
|
235
|
+
end
|
|
236
|
+
unless load_translator = CORL.translator({}, translator_name)
|
|
237
|
+
error('translator_load', { :translator => translator_name })
|
|
238
|
+
return nil
|
|
239
|
+
end
|
|
240
|
+
config.import(load_translator.parse(data))
|
|
241
|
+
translator << load_translator
|
|
242
|
+
end
|
|
203
243
|
end
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
file_exists = translator.empty? ? false : true
|
|
247
|
+
|
|
248
|
+
if settings[:save_format]
|
|
249
|
+
translator = CORL.translator({}, settings[:save_format])
|
|
250
|
+
else
|
|
251
|
+
if translator.empty?
|
|
252
|
+
translator = CORL.translator({}, CORL.type_default(:nucleon, :translator))
|
|
253
|
+
else
|
|
254
|
+
translator = translator.size > 1 ? translator.shift : translator[0]
|
|
255
|
+
end
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
config_file = File.join(config_path, "#{config_file_name}." + translator.plugin_name.to_s)
|
|
204
259
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
config = CORL::Config.new(translator.parse(data))
|
|
211
|
-
elsif File.directory?(config_dir)
|
|
260
|
+
unless file_exists
|
|
261
|
+
hiera_search_path = node.hiera_configuration[:hierarchy]
|
|
262
|
+
config_files = []
|
|
263
|
+
|
|
264
|
+
if File.directory?(config_dir)
|
|
212
265
|
config_files = Dir.glob("#{config_dir}/**/*").select do |file|
|
|
213
266
|
is_config = false
|
|
214
267
|
|
|
@@ -217,41 +270,55 @@ class Config < CORL.plugin_class(:nucleon, :cloud_action)
|
|
|
217
270
|
end
|
|
218
271
|
is_config
|
|
219
272
|
end
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
273
|
+
|
|
274
|
+
config_files.collect! do |file|
|
|
275
|
+
file.sub(/#{network.config_directory + File::SEPARATOR}/, '')
|
|
223
276
|
end
|
|
224
277
|
end
|
|
225
278
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
:
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
279
|
+
ordered_config_files = []
|
|
280
|
+
rendered_config_files = []
|
|
281
|
+
|
|
282
|
+
hiera_search_path.each do |search_path|
|
|
283
|
+
search_components = search_path.split(File::SEPARATOR)
|
|
284
|
+
|
|
285
|
+
rendered_config_files << "SEARCH: #{search_path}"
|
|
286
|
+
|
|
287
|
+
config_files.each do |file|
|
|
288
|
+
file_ext = File.extname(file)
|
|
289
|
+
file_components = file.sub(/\..*$/, '').split(File::SEPARATOR)
|
|
290
|
+
rendered_file_components = []
|
|
291
|
+
file_match = true
|
|
292
|
+
|
|
293
|
+
search_components.each_with_index do |search_item, index|
|
|
294
|
+
if search_item.strip =~ /^%{:?:?([^}]+)}$/ && index < file_components.size
|
|
295
|
+
rendered_file_components << cyan(file_components[index])
|
|
296
|
+
elsif search_item != file_components[index]
|
|
297
|
+
file_match = false
|
|
298
|
+
else
|
|
299
|
+
rendered_file_components << yellow(search_item)
|
|
300
|
+
end
|
|
301
|
+
end
|
|
302
|
+
|
|
303
|
+
rendered_file = " #{rendered_file_components.join(File::SEPARATOR)} [ #{blue(file_ext.sub('.', ''))} ]"
|
|
304
|
+
|
|
305
|
+
if file_match && ! ordered_config_files.include?(file)
|
|
306
|
+
ordered_config_files << file
|
|
307
|
+
rendered_config_files << rendered_file
|
|
308
|
+
end
|
|
309
|
+
end
|
|
310
|
+
end
|
|
248
311
|
end
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
312
|
+
|
|
313
|
+
{
|
|
314
|
+
:translator => translator,
|
|
315
|
+
:file => config_file,
|
|
316
|
+
:files => ordered_config_files,
|
|
317
|
+
:rendered_files => rendered_config_files,
|
|
318
|
+
:property => property,
|
|
319
|
+
:config => config,
|
|
320
|
+
:value => property ? Util::Data.value(config.get(property)) : nil
|
|
321
|
+
}
|
|
255
322
|
end
|
|
256
323
|
end
|
|
257
324
|
end
|
|
@@ -25,6 +25,10 @@ class Create < Nucleon.plugin_class(:nucleon, :cloud_action)
|
|
|
25
25
|
|
|
26
26
|
#---
|
|
27
27
|
|
|
28
|
+
def ignore
|
|
29
|
+
node_ignore
|
|
30
|
+
end
|
|
31
|
+
|
|
28
32
|
def arguments
|
|
29
33
|
[ :project_reference ]
|
|
30
34
|
end
|
|
@@ -34,7 +38,7 @@ class Create < Nucleon.plugin_class(:nucleon, :cloud_action)
|
|
|
34
38
|
|
|
35
39
|
def execute
|
|
36
40
|
super(false) do
|
|
37
|
-
info('
|
|
41
|
+
info('start')
|
|
38
42
|
|
|
39
43
|
project = project_load(settings[:path], true, true)
|
|
40
44
|
myself.status = code.project_failure unless project
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
module Nucleon
|
|
3
3
|
module Action
|
|
4
4
|
module Cloud
|
|
5
|
-
class Images <
|
|
5
|
+
class Images < Nucleon.plugin_class(:nucleon, :cloud_action)
|
|
6
6
|
|
|
7
7
|
#-----------------------------------------------------------------------------
|
|
8
8
|
# Info
|
|
@@ -26,6 +26,11 @@ class Images < CORL.plugin_class(:nucleon, :cloud_action)
|
|
|
26
26
|
end
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
+
def node_config
|
|
30
|
+
super
|
|
31
|
+
config[:node_provider].default = nil
|
|
32
|
+
end
|
|
33
|
+
|
|
29
34
|
#---
|
|
30
35
|
|
|
31
36
|
def ignore
|
|
@@ -40,18 +45,16 @@ class Images < CORL.plugin_class(:nucleon, :cloud_action)
|
|
|
40
45
|
# Operations
|
|
41
46
|
|
|
42
47
|
def execute
|
|
43
|
-
super do |local_node
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
ensure_network(network) do
|
|
48
|
+
super do |local_node|
|
|
49
|
+
ensure_network do
|
|
47
50
|
if node = network.test_node(settings[:node_provider], { :region => settings[:region] })
|
|
48
51
|
if images = node.images(settings[:search], settings)
|
|
49
52
|
images.each do |image|
|
|
50
|
-
info
|
|
53
|
+
prefixed_message(:info, ' ', node.render_image(image), { :i18n => false, :prefix => false })
|
|
51
54
|
end
|
|
52
55
|
|
|
53
56
|
myself.result = images
|
|
54
|
-
success('
|
|
57
|
+
success('results', { :images => images.length }) if images.length > 1
|
|
55
58
|
else
|
|
56
59
|
myself.status = code.image_load_failure
|
|
57
60
|
end
|
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
module Nucleon
|
|
3
3
|
module Action
|
|
4
4
|
module Cloud
|
|
5
|
-
class Inspect <
|
|
6
|
-
|
|
7
|
-
include Mixin::Action::Registration
|
|
5
|
+
class Inspect < Nucleon.plugin_class(:nucleon, :cloud_action)
|
|
8
6
|
|
|
9
7
|
#-----------------------------------------------------------------------------
|
|
10
8
|
# Info
|
|
11
9
|
|
|
12
10
|
def self.describe
|
|
13
|
-
super(:cloud, :inspect,
|
|
11
|
+
super(:cloud, :inspect, 955)
|
|
14
12
|
end
|
|
15
13
|
|
|
16
14
|
#-----------------------------------------------------------------------------
|
|
@@ -26,6 +24,10 @@ class Inspect < CORL.plugin_class(:nucleon, :cloud_action)
|
|
|
26
24
|
end
|
|
27
25
|
|
|
28
26
|
#---
|
|
27
|
+
|
|
28
|
+
def ignore
|
|
29
|
+
node_ignore
|
|
30
|
+
end
|
|
29
31
|
|
|
30
32
|
def arguments
|
|
31
33
|
[ :elements ]
|
|
@@ -35,8 +37,8 @@ class Inspect < CORL.plugin_class(:nucleon, :cloud_action)
|
|
|
35
37
|
# Operations
|
|
36
38
|
|
|
37
39
|
def execute
|
|
38
|
-
super do |node
|
|
39
|
-
ensure_network
|
|
40
|
+
super do |node|
|
|
41
|
+
ensure_network do
|
|
40
42
|
if settings[:elements].empty?
|
|
41
43
|
data = network.config.export
|
|
42
44
|
else
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
module Nucleon
|
|
3
3
|
module Action
|
|
4
4
|
module Cloud
|
|
5
|
-
class Machines <
|
|
5
|
+
class Machines < Nucleon.plugin_class(:nucleon, :cloud_action)
|
|
6
6
|
|
|
7
7
|
#-----------------------------------------------------------------------------
|
|
8
8
|
# Info
|
|
@@ -21,6 +21,11 @@ class Machines < CORL.plugin_class(:nucleon, :cloud_action)
|
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
+
def node_config
|
|
25
|
+
super
|
|
26
|
+
config[:node_provider].default = nil
|
|
27
|
+
end
|
|
28
|
+
|
|
24
29
|
#---
|
|
25
30
|
|
|
26
31
|
def ignore
|
|
@@ -35,18 +40,16 @@ class Machines < CORL.plugin_class(:nucleon, :cloud_action)
|
|
|
35
40
|
# Operations
|
|
36
41
|
|
|
37
42
|
def execute
|
|
38
|
-
super do |local_node
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
ensure_network(network) do
|
|
43
|
+
super do |local_node|
|
|
44
|
+
ensure_network do
|
|
42
45
|
if node = network.test_node(settings[:node_provider])
|
|
43
46
|
if machine_types = node.machine_types
|
|
44
47
|
machine_types.each do |machine_type|
|
|
45
|
-
info
|
|
48
|
+
prefixed_message(:info, ' ', node.render_machine_type(machine_type), { :i18n => false, :prefix => false })
|
|
46
49
|
end
|
|
47
50
|
|
|
48
51
|
myself.result = machine_types
|
|
49
|
-
success('
|
|
52
|
+
success('results', { :machines => machine_types.length }) if machine_types.length > 1
|
|
50
53
|
else
|
|
51
54
|
myself.status = code.machine_load_failure
|
|
52
55
|
end
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
module Nucleon
|
|
3
3
|
module Action
|
|
4
4
|
module Cloud
|
|
5
|
-
class Regions <
|
|
5
|
+
class Regions < Nucleon.plugin_class(:nucleon, :cloud_action)
|
|
6
6
|
|
|
7
7
|
#-----------------------------------------------------------------------------
|
|
8
8
|
# Info
|
|
@@ -18,7 +18,12 @@ class Regions < CORL.plugin_class(:nucleon, :cloud_action)
|
|
|
18
18
|
super do
|
|
19
19
|
codes :node_load_failure,
|
|
20
20
|
:region_load_failure
|
|
21
|
-
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def node_config
|
|
25
|
+
super
|
|
26
|
+
config[:node_provider].default = nil
|
|
22
27
|
end
|
|
23
28
|
|
|
24
29
|
#---
|
|
@@ -35,18 +40,18 @@ class Regions < CORL.plugin_class(:nucleon, :cloud_action)
|
|
|
35
40
|
# Operations
|
|
36
41
|
|
|
37
42
|
def execute
|
|
38
|
-
super do |local_node
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
ensure_network(network) do
|
|
43
|
+
super do |local_node|
|
|
44
|
+
ensure_network do
|
|
42
45
|
if node = network.test_node(settings[:node_provider])
|
|
43
46
|
if regions = node.regions
|
|
47
|
+
region_info = node.region_info
|
|
48
|
+
max_length = regions.collect {|value| value.length }.sort.pop
|
|
49
|
+
|
|
44
50
|
regions.each do |region|
|
|
45
|
-
info
|
|
51
|
+
prefixed_message(:info, ' ', sprintf("%-#{max_length + 10}s %s", purple(region), yellow(region_info[region.to_sym])), { :i18n => false, :prefix => false })
|
|
46
52
|
end
|
|
47
53
|
|
|
48
54
|
myself.result = regions
|
|
49
|
-
success('corl.actions.regions.results', { :regions => regions.length }) if regions.length > 1
|
|
50
55
|
else
|
|
51
56
|
myself.status = code.region_load_failure
|
|
52
57
|
end
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
|
|
2
|
+
module Nucleon
|
|
3
|
+
module Action
|
|
4
|
+
module Cloud
|
|
5
|
+
class Remote < CORL.plugin_class(:nucleon, :cloud_action)
|
|
6
|
+
|
|
7
|
+
include Mixin::Action::Project
|
|
8
|
+
include Mixin::Action::Push
|
|
9
|
+
|
|
10
|
+
#-----------------------------------------------------------------------------
|
|
11
|
+
# Info
|
|
12
|
+
|
|
13
|
+
def self.describe
|
|
14
|
+
super([ :cloud ], :remote, 980)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
#-----------------------------------------------------------------------------
|
|
18
|
+
# Settings
|
|
19
|
+
|
|
20
|
+
def configure
|
|
21
|
+
super do
|
|
22
|
+
codes :project_failure, :push_failure
|
|
23
|
+
|
|
24
|
+
project_config
|
|
25
|
+
push_config
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
#---
|
|
30
|
+
|
|
31
|
+
def ignore
|
|
32
|
+
node_ignore + [ :propogate_push, :pull, :push, :net_remote ]
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def arguments
|
|
36
|
+
[ :project_reference ]
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
#-----------------------------------------------------------------------------
|
|
40
|
+
# Operations
|
|
41
|
+
|
|
42
|
+
def execute
|
|
43
|
+
super do |node|
|
|
44
|
+
ensure_network do
|
|
45
|
+
info('start')
|
|
46
|
+
|
|
47
|
+
settings[:pull] = false
|
|
48
|
+
settings[:push] = true
|
|
49
|
+
|
|
50
|
+
if project = project_load(network.directory, false, false)
|
|
51
|
+
provider = settings[:project_provider]
|
|
52
|
+
|
|
53
|
+
if settings[:project_reference].match(/^\s*([a-zA-Z0-9_-]+):::(.*)\s*$/)
|
|
54
|
+
provider = $1
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
Nucleon::Plugin::Project.store_provider(project.directory, provider)
|
|
58
|
+
myself.status = code.push_failure unless push(project)
|
|
59
|
+
else
|
|
60
|
+
myself.status = code.project_failure
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|