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.
Files changed (241) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/Gemfile.lock +8 -6
  4. data/VERSION +1 -1
  5. data/bootstrap/os/ubuntu/00_base.sh +2 -2
  6. data/bootstrap/os/ubuntu/05_ruby.sh +14 -2
  7. data/corl.gemspec +175 -5
  8. data/lib/CORL/builder/identity.rb +1 -1
  9. data/lib/CORL/builder/package.rb +1 -1
  10. data/lib/CORL/configuration/file.rb +7 -13
  11. data/lib/CORL/machine/physical.rb +1 -1
  12. data/lib/CORL/machine/vagrant.rb +12 -4
  13. data/lib/CORL/network/CORL.rb +1 -1
  14. data/lib/CORL/node/AWS.rb +25 -23
  15. data/lib/CORL/node/local.rb +1 -1
  16. data/lib/CORL/node/rackspace.rb +13 -15
  17. data/lib/CORL/node/vagrant.rb +1 -1
  18. data/lib/CORL/provisioner/puppetnode.rb +1 -1
  19. data/lib/core/mixin/action/keypair.rb +6 -6
  20. data/lib/core/mixin/action/registration.rb +39 -11
  21. data/lib/core/mod/fog_aws_server.rb +1 -3
  22. data/lib/core/plugin/builder.rb +1 -1
  23. data/lib/core/plugin/cloud_action.rb +59 -49
  24. data/lib/core/plugin/configuration.rb +4 -3
  25. data/lib/core/plugin/fog_machine.rb +10 -2
  26. data/lib/core/plugin/fog_node.rb +10 -4
  27. data/lib/core/plugin/machine.rb +2 -8
  28. data/lib/core/plugin/network.rb +9 -3
  29. data/lib/core/plugin/node.rb +30 -31
  30. data/lib/core/plugin/provisioner.rb +1 -1
  31. data/lib/core/vagrant/Vagrantfile +4 -1
  32. data/lib/core/vagrant/plugins.rb +6 -4
  33. data/lib/corl.rb +1 -1
  34. data/lib/nucleon/action/cloud/config.rb +167 -100
  35. data/lib/nucleon/action/cloud/create.rb +5 -1
  36. data/lib/nucleon/action/cloud/images.rb +10 -7
  37. data/lib/nucleon/action/cloud/inspect.rb +8 -6
  38. data/lib/nucleon/action/cloud/machines.rb +10 -7
  39. data/lib/nucleon/action/cloud/regions.rb +13 -8
  40. data/lib/nucleon/action/cloud/remote.rb +68 -0
  41. data/lib/nucleon/action/cloud/settings.rb +33 -47
  42. data/lib/nucleon/action/cloud/vagrantfile.rb +34 -17
  43. data/lib/nucleon/action/node/IP.rb +2 -2
  44. data/lib/nucleon/action/node/SSH.rb +3 -3
  45. data/lib/nucleon/action/node/authorize.rb +2 -2
  46. data/lib/nucleon/action/node/bootstrap.rb +17 -30
  47. data/lib/nucleon/action/node/build.rb +4 -4
  48. data/lib/nucleon/action/node/cache.rb +2 -4
  49. data/lib/nucleon/action/node/destroy.rb +25 -26
  50. data/lib/nucleon/action/node/exec.rb +2 -2
  51. data/lib/nucleon/action/node/fact.rb +10 -5
  52. data/lib/nucleon/action/node/group.rb +10 -5
  53. data/lib/nucleon/action/node/identity.rb +6 -8
  54. data/lib/nucleon/action/node/image.rb +3 -3
  55. data/lib/nucleon/action/node/keypair.rb +2 -2
  56. data/lib/nucleon/action/node/lookup.rb +2 -4
  57. data/lib/nucleon/action/node/provision.rb +2 -2
  58. data/lib/nucleon/action/node/reboot.rb +3 -3
  59. data/lib/nucleon/action/node/revoke.rb +2 -2
  60. data/lib/nucleon/action/node/seed.rb +28 -43
  61. data/lib/nucleon/action/node/spawn.rb +19 -14
  62. data/lib/nucleon/action/node/start.rb +3 -3
  63. data/lib/nucleon/action/node/status.rb +8 -8
  64. data/lib/nucleon/action/node/stop.rb +3 -3
  65. data/lib/nucleon/action/plugin/create.rb +10 -13
  66. data/lib/nucleon/action/plugin/list.rb +7 -7
  67. data/lib/nucleon/action/plugin/template/nucleon.action.erb +2 -2
  68. data/lib/nucleon/action/plugins.rb +12 -1
  69. data/lib/nucleon/event/puppet.rb +1 -1
  70. data/lib/nucleon/extension/corl_config.rb +26 -0
  71. data/lib/nucleon/template/environment.rb +1 -1
  72. data/locales/en.yml +483 -90
  73. data/rdoc/site/0.5.1/CORL/Build.html +781 -0
  74. data/rdoc/site/0.5.1/CORL/Builder/Identity.html +596 -0
  75. data/rdoc/site/0.5.1/CORL/Builder/Package.html +600 -0
  76. data/rdoc/site/0.5.1/CORL/Builder.html +384 -0
  77. data/rdoc/site/0.5.1/CORL/Configuration/File.html +1186 -0
  78. data/rdoc/site/0.5.1/CORL/Configuration.html +383 -0
  79. data/rdoc/site/0.5.1/CORL/Errors.html +383 -0
  80. data/rdoc/site/0.5.1/CORL/Facade.html +927 -0
  81. data/rdoc/site/0.5.1/CORL/Machine/AWS.html +777 -0
  82. data/rdoc/site/0.5.1/CORL/Machine/Fog.html +1313 -0
  83. data/rdoc/site/0.5.1/CORL/Machine/Physical.html +1083 -0
  84. data/rdoc/site/0.5.1/CORL/Machine/Rackspace.html +558 -0
  85. data/rdoc/site/0.5.1/CORL/Machine/Vagrant.html +1344 -0
  86. data/rdoc/site/0.5.1/CORL/Machine.html +387 -0
  87. data/rdoc/site/0.5.1/CORL/Mixin/Action/Keypair.html +616 -0
  88. data/rdoc/site/0.5.1/CORL/Mixin/Action/Registration.html +469 -0
  89. data/rdoc/site/0.5.1/CORL/Mixin/Action.html +384 -0
  90. data/rdoc/site/0.5.1/CORL/Mixin/Builder/Global.html +628 -0
  91. data/rdoc/site/0.5.1/CORL/Mixin/Builder/Instance.html +720 -0
  92. data/rdoc/site/0.5.1/CORL/Mixin/Builder.html +383 -0
  93. data/rdoc/site/0.5.1/CORL/Mixin/Lookup.html +1315 -0
  94. data/rdoc/site/0.5.1/CORL/Mixin/Machine/SSH.html +699 -0
  95. data/rdoc/site/0.5.1/CORL/Mixin/Machine.html +383 -0
  96. data/rdoc/site/0.5.1/CORL/Mixin/Macro/NetworkSettings.html +508 -0
  97. data/rdoc/site/0.5.1/CORL/Mixin/Macro.html +383 -0
  98. data/rdoc/site/0.5.1/CORL/Mixin.html +388 -0
  99. data/rdoc/site/0.5.1/CORL/Network/CORL.html +435 -0
  100. data/rdoc/site/0.5.1/CORL/Network.html +383 -0
  101. data/rdoc/site/0.5.1/CORL/Node/AWS.html +760 -0
  102. data/rdoc/site/0.5.1/CORL/Node/Fog.html +1268 -0
  103. data/rdoc/site/0.5.1/CORL/Node/Local.html +468 -0
  104. data/rdoc/site/0.5.1/CORL/Node/Rackspace.html +753 -0
  105. data/rdoc/site/0.5.1/CORL/Node/Vagrant.html +1497 -0
  106. data/rdoc/site/0.5.1/CORL/Node.html +387 -0
  107. data/rdoc/site/0.5.1/CORL/Plugin/Builder.html +524 -0
  108. data/rdoc/site/0.5.1/CORL/Plugin/Configuration.html +1294 -0
  109. data/rdoc/site/0.5.1/CORL/Plugin/Machine.html +1323 -0
  110. data/rdoc/site/0.5.1/CORL/Plugin/Network.html +1766 -0
  111. data/rdoc/site/0.5.1/CORL/Plugin/Node.html +4263 -0
  112. data/rdoc/site/0.5.1/CORL/Plugin/Provisioner.html +1139 -0
  113. data/rdoc/site/0.5.1/CORL/Plugin.html +673 -0
  114. data/rdoc/site/0.5.1/CORL/Provisioner/Puppetnode.html +1201 -0
  115. data/rdoc/site/0.5.1/CORL/Provisioner.html +383 -0
  116. data/rdoc/site/0.5.1/CORL/Util/Puppet/Resource.html +1082 -0
  117. data/rdoc/site/0.5.1/CORL/Util/Puppet/ResourceGroup.html +964 -0
  118. data/rdoc/site/0.5.1/CORL/Util/Puppet.html +1131 -0
  119. data/rdoc/site/0.5.1/CORL/Util.html +385 -0
  120. data/rdoc/site/0.5.1/CORL/Vagrant/Config.html +967 -0
  121. data/rdoc/site/0.5.1/CORL/Vagrant.html +462 -0
  122. data/rdoc/site/0.5.1/CORL.html +496 -0
  123. data/rdoc/site/0.5.1/Fog/Compute/AWS/Server.html +467 -0
  124. data/rdoc/site/0.5.1/Fog/Compute/AWS.html +389 -0
  125. data/rdoc/site/0.5.1/Fog/Compute/RackspaceV2/Server.html +452 -0
  126. data/rdoc/site/0.5.1/Fog/Compute/RackspaceV2.html +389 -0
  127. data/rdoc/site/0.5.1/Fog/Compute.html +384 -0
  128. data/rdoc/site/0.5.1/Fog.html +384 -0
  129. data/rdoc/site/0.5.1/Hiera/Backend.html +466 -0
  130. data/rdoc/site/0.5.1/Hiera/Corl_logger.html +493 -0
  131. data/rdoc/site/0.5.1/Hiera.html +390 -0
  132. data/rdoc/site/0.5.1/Nucleon/Action/Cloud/Config.html +978 -0
  133. data/rdoc/site/0.5.1/Nucleon/Action/Cloud/Create.html +562 -0
  134. data/rdoc/site/0.5.1/Nucleon/Action/Cloud/Images.html +596 -0
  135. data/rdoc/site/0.5.1/Nucleon/Action/Cloud/Inspect.html +567 -0
  136. data/rdoc/site/0.5.1/Nucleon/Action/Cloud/Machines.html +591 -0
  137. data/rdoc/site/0.5.1/Nucleon/Action/Cloud/Regions.html +591 -0
  138. data/rdoc/site/0.5.1/Nucleon/Action/Cloud/Settings.html +878 -0
  139. data/rdoc/site/0.5.1/Nucleon/Action/Cloud/Vagrantfile.html +539 -0
  140. data/rdoc/site/0.5.1/Nucleon/Action/Cloud.html +390 -0
  141. data/rdoc/site/0.5.1/Nucleon/Action/Node/Authorize.html +567 -0
  142. data/rdoc/site/0.5.1/Nucleon/Action/Node/Bootstrap.html +628 -0
  143. data/rdoc/site/0.5.1/Nucleon/Action/Node/Build.html +550 -0
  144. data/rdoc/site/0.5.1/Nucleon/Action/Node/Cache.html +773 -0
  145. data/rdoc/site/0.5.1/Nucleon/Action/Node/Destroy.html +597 -0
  146. data/rdoc/site/0.5.1/Nucleon/Action/Node/Exec.html +554 -0
  147. data/rdoc/site/0.5.1/Nucleon/Action/Node/Fact.html +733 -0
  148. data/rdoc/site/0.5.1/Nucleon/Action/Node/Facts.html +505 -0
  149. data/rdoc/site/0.5.1/Nucleon/Action/Node/Group.html +729 -0
  150. data/rdoc/site/0.5.1/Nucleon/Action/Node/Groups.html +505 -0
  151. data/rdoc/site/0.5.1/Nucleon/Action/Node/IP.html +477 -0
  152. data/rdoc/site/0.5.1/Nucleon/Action/Node/Identity.html +614 -0
  153. data/rdoc/site/0.5.1/Nucleon/Action/Node/Image.html +597 -0
  154. data/rdoc/site/0.5.1/Nucleon/Action/Node/Keypair.html +596 -0
  155. data/rdoc/site/0.5.1/Nucleon/Action/Node/Lookup.html +579 -0
  156. data/rdoc/site/0.5.1/Nucleon/Action/Node/Provision.html +577 -0
  157. data/rdoc/site/0.5.1/Nucleon/Action/Node/Reboot.html +597 -0
  158. data/rdoc/site/0.5.1/Nucleon/Action/Node/Revoke.html +565 -0
  159. data/rdoc/site/0.5.1/Nucleon/Action/Node/SSH.html +607 -0
  160. data/rdoc/site/0.5.1/Nucleon/Action/Node/Seed.html +626 -0
  161. data/rdoc/site/0.5.1/Nucleon/Action/Node/Spawn.html +699 -0
  162. data/rdoc/site/0.5.1/Nucleon/Action/Node/Start.html +597 -0
  163. data/rdoc/site/0.5.1/Nucleon/Action/Node/Status.html +615 -0
  164. data/rdoc/site/0.5.1/Nucleon/Action/Node/Stop.html +597 -0
  165. data/rdoc/site/0.5.1/Nucleon/Action/Node.html +406 -0
  166. data/rdoc/site/0.5.1/Nucleon/Action/Plugin/Create.html +736 -0
  167. data/rdoc/site/0.5.1/Nucleon/Action/Plugin/List.html +570 -0
  168. data/rdoc/site/0.5.1/Nucleon/Action/Plugin.html +384 -0
  169. data/rdoc/site/0.5.1/Nucleon/Action/Plugins.html +435 -0
  170. data/rdoc/site/0.5.1/Nucleon/Action.html +417 -0
  171. data/rdoc/site/0.5.1/Nucleon/Config.html +401 -0
  172. data/rdoc/site/0.5.1/Nucleon/Event/Puppet.html +717 -0
  173. data/rdoc/site/0.5.1/Nucleon/Event.html +383 -0
  174. data/rdoc/site/0.5.1/Nucleon/Plugin/Base.html +389 -0
  175. data/rdoc/site/0.5.1/Nucleon/Plugin/CloudAction.html +894 -0
  176. data/rdoc/site/0.5.1/Nucleon/Plugin.html +384 -0
  177. data/rdoc/site/0.5.1/Nucleon/Template/Environment.html +572 -0
  178. data/rdoc/site/0.5.1/Nucleon/Template.html +383 -0
  179. data/rdoc/site/0.5.1/Nucleon.html +421 -0
  180. data/rdoc/site/0.5.1/Object.html +402 -0
  181. data/rdoc/site/0.5.1/Puppet/DataBinding/Corl.html +389 -0
  182. data/rdoc/site/0.5.1/Puppet/DataBinding.html +382 -0
  183. data/rdoc/site/0.5.1/Puppet/Indirector/Corl.html +501 -0
  184. data/rdoc/site/0.5.1/Puppet/Indirector.html +382 -0
  185. data/rdoc/site/0.5.1/Puppet/Parser/Functions.html +524 -0
  186. data/rdoc/site/0.5.1/Puppet/Parser.html +382 -0
  187. data/rdoc/site/0.5.1/Puppet.html +382 -0
  188. data/rdoc/site/0.5.1/README_rdoc.html +384 -0
  189. data/rdoc/site/0.5.1/Vagrant/Config/Loader.html +443 -0
  190. data/rdoc/site/0.5.1/Vagrant/Config.html +383 -0
  191. data/rdoc/site/0.5.1/Vagrant/Vagrantfile.html +436 -0
  192. data/rdoc/site/0.5.1/Vagrant.html +390 -0
  193. data/rdoc/site/0.5.1/VagrantPlugins/CORL/Action/DeleteCache.html +446 -0
  194. data/rdoc/site/0.5.1/VagrantPlugins/CORL/Action/InitKeys.html +452 -0
  195. data/rdoc/site/0.5.1/VagrantPlugins/CORL/Action/LinkNetwork.html +450 -0
  196. data/rdoc/site/0.5.1/VagrantPlugins/CORL/Action.html +385 -0
  197. data/rdoc/site/0.5.1/VagrantPlugins/CORL/BaseAction.html +535 -0
  198. data/rdoc/site/0.5.1/VagrantPlugins/CORL/Command/Launcher.html +577 -0
  199. data/rdoc/site/0.5.1/VagrantPlugins/CORL/Command.html +383 -0
  200. data/rdoc/site/0.5.1/VagrantPlugins/CORL/Config/CORL.html +776 -0
  201. data/rdoc/site/0.5.1/VagrantPlugins/CORL/Config.html +383 -0
  202. data/rdoc/site/0.5.1/VagrantPlugins/CORL/Plugin.html +389 -0
  203. data/rdoc/site/0.5.1/VagrantPlugins/CORL/Provisioner/CORL.html +580 -0
  204. data/rdoc/site/0.5.1/VagrantPlugins/CORL/Provisioner.html +383 -0
  205. data/rdoc/site/0.5.1/VagrantPlugins/CORL.html +390 -0
  206. data/rdoc/site/0.5.1/VagrantPlugins.html +390 -0
  207. data/rdoc/site/0.5.1/created.rid +114 -0
  208. data/rdoc/site/0.5.1/images/add.png +0 -0
  209. data/rdoc/site/0.5.1/images/brick.png +0 -0
  210. data/rdoc/site/0.5.1/images/brick_link.png +0 -0
  211. data/rdoc/site/0.5.1/images/bug.png +0 -0
  212. data/rdoc/site/0.5.1/images/bullet_black.png +0 -0
  213. data/rdoc/site/0.5.1/images/bullet_toggle_minus.png +0 -0
  214. data/rdoc/site/0.5.1/images/bullet_toggle_plus.png +0 -0
  215. data/rdoc/site/0.5.1/images/date.png +0 -0
  216. data/rdoc/site/0.5.1/images/delete.png +0 -0
  217. data/rdoc/site/0.5.1/images/find.png +0 -0
  218. data/rdoc/site/0.5.1/images/loadingAnimation.gif +0 -0
  219. data/rdoc/site/0.5.1/images/macFFBgHack.png +0 -0
  220. data/rdoc/site/0.5.1/images/package.png +0 -0
  221. data/rdoc/site/0.5.1/images/page_green.png +0 -0
  222. data/rdoc/site/0.5.1/images/page_white_text.png +0 -0
  223. data/rdoc/site/0.5.1/images/page_white_width.png +0 -0
  224. data/rdoc/site/0.5.1/images/plugin.png +0 -0
  225. data/rdoc/site/0.5.1/images/ruby.png +0 -0
  226. data/rdoc/site/0.5.1/images/tag_blue.png +0 -0
  227. data/rdoc/site/0.5.1/images/tag_green.png +0 -0
  228. data/rdoc/site/0.5.1/images/transparent.png +0 -0
  229. data/rdoc/site/0.5.1/images/wrench.png +0 -0
  230. data/rdoc/site/0.5.1/images/wrench_orange.png +0 -0
  231. data/rdoc/site/0.5.1/images/zoom.png +0 -0
  232. data/rdoc/site/0.5.1/index.html +383 -0
  233. data/rdoc/site/0.5.1/js/darkfish.js +155 -0
  234. data/rdoc/site/0.5.1/js/jquery.js +18 -0
  235. data/rdoc/site/0.5.1/js/navigation.js +142 -0
  236. data/rdoc/site/0.5.1/js/search.js +94 -0
  237. data/rdoc/site/0.5.1/js/search_index.js +1 -0
  238. data/rdoc/site/0.5.1/js/searcher.js +228 -0
  239. data/rdoc/site/0.5.1/rdoc.css +543 -0
  240. data/rdoc/site/0.5.1/table_of_contents.html +2005 -0
  241. metadata +174 -4
@@ -2,9 +2,7 @@
2
2
  module Nucleon
3
3
  module Action
4
4
  module Cloud
5
- class Config < CORL.plugin_class(:nucleon, :cloud_action)
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, nil
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 :load_format, :json
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
- [ :nodes ]
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, network|
52
- ensure_network(network) do
53
- config_info = parse_config_reference(network, settings[:name])
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 config_info[:property].nil?
60
- render_config_properties(network, config_info)
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(network, config_info, settings[:value], sanitize_remote(network, settings[:net_remote]))
65
+ set_config_property(config_info, settings[:value])
67
66
  else
68
- render_config_property(network, config_info)
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(network, config_info)
78
- if file_labels = config_info[:files]
79
- info("Sub configurations available:", { :i18n => false })
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("-> #{yellow(label)}", { :i18n => false })
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(network, config_info)
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(network, config_info, remote = nil)
101
- name = parse_property_name(config_info[:property])
102
- remote_text = remote_message(remote)
103
- config_file = config_info[:file].sub(network.directory + File::SEPARATOR, '')
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
- config_info[:config].delete(config_info[:property])
111
+ config_info[:config].delete(config_info[:property])
106
112
 
107
- if File.exists?(config_info[:file])
108
- if Util::Disk.write(config_info[:file], config_info[:translator].generate(config_info[:config].export))
109
- if network.save({ :files => config_file, :remote => remote, :message => "Deleting configuration #{name} from #{config_file}", :allow_empty => true })
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("Configuration `#{blue(name)}` deletion could not be saved", { :i18n => false })
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
- error("Configuration file `#{blue(config_file)}` could not be saved", { :i18n => false })
117
- myself.status = code.configuration_save_failed
121
+ info('no_config_file', render_options)
118
122
  end
119
123
  else
120
- info("Configuration file `#{blue(config_file)} does not exist so configuration can not be deleted", { :i18n => false })
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(network, config_info, values, remote = nil)
127
- name = parse_property_name(config_info[:property])
128
- remote_text = remote_message(remote)
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
- values[index] = render(value, {
135
- :format => input_format,
136
- :silent => true
137
- }) if input_format
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 values.size == 1
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 => remote, :message => "Updating configuration #{name} in #{config_file}", :allow_empty => true })
163
- success("Configuration `#{blue(name)}` update (#{yellow(remote_text)})", { :i18n => false })
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("Configuration `#{blue(name)}` update could not be saved", { :i18n => false })
189
+ error('update', render_options)
166
190
  myself.status = code.configuration_save_failed
167
191
  end
168
192
  else
169
- error("Configuration file `#{blue(config_file)}` could not be saved", { :i18n => false })
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(network, name)
178
- info = {}
179
- data = {}
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
- config_dir = File.join(config_path, config_file_name)
196
- config_file = File.join(config_path, "#{config_file_name}." + settings[:load_format].to_s)
197
- config_files = nil
198
- property = property.gsub(/\]$/, '').split(/\]?\[/) if property
199
-
200
- unless translator = CORL.translator({}, settings[:load_format])
201
- error("Translator for #{settings[:format]} could not be loaded", { :i18n => false })
202
- return nil
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
- if File.exists?(config_file)
206
- unless data = Util::Disk.read(config_file)
207
- error("Failed to read file: #{config_file}", { :i18n => false })
208
- return nil
209
- end
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
- config_files.each_with_index do |file, index|
221
- config_files[index] = file.sub(/#{network.config_directory + File::SEPARATOR}/, '')
222
- config_files[index] = config_files[index].sub(/\.([a-z0-9]+)$/, ' [ ' + blue('\1') + ' ]')
273
+
274
+ config_files.collect! do |file|
275
+ file.sub(/#{network.config_directory + File::SEPARATOR}/, '')
223
276
  end
224
277
  end
225
278
 
226
- config = CORL::Config.new unless config
227
- info = {
228
- :translator => translator,
229
- :file => config_file,
230
- :files => config_files,
231
- :property => property,
232
- :config => config,
233
- :value => property ? Util::Data.value(config.get(property)) : nil
234
- }
235
- end
236
- info
237
- end
238
-
239
- #---
240
-
241
- def parse_property_name(property)
242
- property = property.clone
243
-
244
- if property.size > 1
245
- property.shift.to_s + '[' + property.join('][') + ']'
246
- else
247
- property.shift.to_s
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
- end
250
-
251
- #---
252
-
253
- def remote_message(remote)
254
- remote ? "#{remote}" : "LOCAL ONLY"
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('nucleon.action.cloud.create.start')
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 < CORL.plugin_class(:nucleon, :cloud_action)
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, network|
44
- info('corl.actions.images.start')
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(node.render_image(image), { :prefix => false, :i18n => false })
53
+ prefixed_message(:info, ' ', node.render_image(image), { :i18n => false, :prefix => false })
51
54
  end
52
55
 
53
56
  myself.result = images
54
- success('corl.actions.images.results', { :images => images.length }) if images.length > 1
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 < CORL.plugin_class(:nucleon, :cloud_action)
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, 950)
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, network|
39
- ensure_network(network) do
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 < CORL.plugin_class(:nucleon, :cloud_action)
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, network|
39
- info('corl.actions.machines.start')
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(node.render_machine_type(machine_type), { :prefix => false, :i18n => false })
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('corl.actions.machines.results', { :machines => machine_types.length }) if machine_types.length > 1
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 < CORL.plugin_class(:nucleon, :cloud_action)
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, network|
39
- info('corl.actions.regions.start')
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(sprintf("> %s", region), { :prefix => false, :i18n => false })
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