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,15 +2,13 @@
2
2
  module Nucleon
3
3
  module Action
4
4
  module Cloud
5
- class Settings < CORL.plugin_class(:nucleon, :cloud_action)
6
-
7
- include Mixin::Action::Registration
5
+ class Settings < Nucleon.plugin_class(:nucleon, :cloud_action)
8
6
 
9
7
  #-----------------------------------------------------------------------------
10
8
  # Info
11
9
 
12
10
  def self.describe
13
- super(:cloud, :settings, 951)
11
+ super(:cloud, :settings, 950)
14
12
  end
15
13
 
16
14
  #-----------------------------------------------------------------------------
@@ -25,6 +23,7 @@ class Settings < CORL.plugin_class(:nucleon, :cloud_action)
25
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
  register_bool :groups
@@ -37,7 +36,7 @@ class Settings < 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,28 +47,28 @@ class Settings < 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
50
+ super do |node|
51
+ ensure_network do
53
52
  if settings[:groups]
54
- render_groups(network)
53
+ render_groups
55
54
 
56
55
  elsif settings[:group].empty?
57
- render_settings(network)
56
+ render_settings
58
57
 
59
58
  elsif settings[:name].empty?
60
- render_settings(network, settings[:group])
59
+ render_settings(settings[:group])
61
60
 
62
61
  else
63
62
  name = settings[:name].gsub(/\]$/, '').split(/\]?\[/)
64
63
 
65
64
  if settings.get(:delete, false)
66
- delete_settings(network, name, sanitize_remote(network, settings[:net_remote]))
65
+ delete_settings(name)
67
66
 
68
67
  elsif ! settings[:value].empty?
69
- set_settings(network, name, settings[:value], sanitize_remote(network, settings[:net_remote]))
68
+ set_settings(name, settings[:value])
70
69
 
71
70
  else
72
- render_settings(network, [ settings[:group], name ])
71
+ render_settings([ settings[:group], name ])
73
72
  end
74
73
  end
75
74
  end
@@ -77,12 +76,12 @@ class Settings < CORL.plugin_class(:nucleon, :cloud_action)
77
76
  end
78
77
 
79
78
  #-----------------------------------------------------------------------------
80
- # Sub operations
79
+ # Settings operations
81
80
 
82
- def render_groups(network)
81
+ def render_groups
83
82
  groups = network.config.get(:settings).keys
84
83
 
85
- info("Currently defined groups:", { :i18n => false })
84
+ info('groups')
86
85
  groups.each do |group|
87
86
  info("-> #{green(group)}", { :i18n => false })
88
87
  end
@@ -90,7 +89,7 @@ class Settings < CORL.plugin_class(:nucleon, :cloud_action)
90
89
 
91
90
  #---
92
91
 
93
- def render_settings(network, elements = [])
92
+ def render_settings(elements = [])
94
93
  format = settings[:format]
95
94
 
96
95
  if elements.size > 0
@@ -103,27 +102,31 @@ class Settings < CORL.plugin_class(:nucleon, :cloud_action)
103
102
 
104
103
  #---
105
104
 
106
- def delete_settings(network, property, remote = nil)
105
+ def delete_settings(property)
107
106
  group = settings[:group]
108
107
  name = parse_property_name(property)
109
- remote_text = remote_message(remote)
108
+ remote_text = remote_message(settings[:net_remote])
109
+
110
+ render_options = { :group => blue(group), :name => blue(name), :remote_text => yellow(remote_text) }
110
111
 
111
112
  network.config.delete([ :settings, group, property ])
112
113
 
113
- if network.save({ :remote => remote, :message => "Deleting #{group} setting #{name}", :allow_empty => true })
114
- success("Group #{blue(group)} setting `#{blue(name)}` deleted (#{yellow(remote_text)})", { :i18n => false })
114
+ if network.save({ :remote => settings[:net_remote], :message => "Deleting #{group} setting #{name}", :allow_empty => true })
115
+ success('delete', render_options)
115
116
  else
116
- error("Group #{blue(group)} setting `#{blue(name)}` deletion could not be saved", { :i18n => false })
117
+ error('delete', render_options)
117
118
  myself.status = code.settings_delete_failed
118
119
  end
119
120
  end
120
121
 
121
122
  #---
122
123
 
123
- def set_settings(network, property, values, remote = nil)
124
+ def set_settings(property, values)
124
125
  group = settings[:group]
125
126
  name = parse_property_name(property)
126
- remote_text = remote_message(remote)
127
+ remote_text = remote_message(settings[:net_remote])
128
+
129
+ render_options = { :group => blue(group), :name => blue(name), :remote_text => yellow(remote_text) }
127
130
 
128
131
  input_format = settings[:input_format]
129
132
 
@@ -145,7 +148,9 @@ class Settings < CORL.plugin_class(:nucleon, :cloud_action)
145
148
  values = prev_value
146
149
  end
147
150
  else
148
- if values.size == 1
151
+ if settings[:array]
152
+ values = array(values)
153
+ elsif values.size == 1
149
154
  values = values[0]
150
155
  end
151
156
  end
@@ -153,32 +158,13 @@ class Settings < CORL.plugin_class(:nucleon, :cloud_action)
153
158
  myself.result = values
154
159
  network.config.set([ :settings, group, property ], result)
155
160
 
156
- if network.save({ :remote => remote, :message => "Updating #{group} setting #{name}", :allow_empty => true })
157
- success("Group #{blue(group)} setting `#{blue(name)}` updated (#{yellow(remote_text)})", { :i18n => false })
161
+ if network.save({ :remote => settings[:net_remote], :message => "Updating #{group} setting #{name}", :allow_empty => true })
162
+ success('update', render_options)
158
163
  else
159
- error("Group #{blue(group)} setting `#{blue(name)}` update could not be saved", { :i18n => false })
164
+ error('update', render_options)
160
165
  myself.status = code.settings_save_failed
161
166
  end
162
167
  end
163
-
164
- #-----------------------------------------------------------------------------
165
- # Utilities
166
-
167
- def parse_property_name(property)
168
- property = property.clone
169
-
170
- if property.size > 1
171
- property.shift.to_s + '[' + property.join('][') + ']'
172
- else
173
- property.shift.to_s
174
- end
175
- end
176
-
177
- #---
178
-
179
- def remote_message(remote)
180
- remote ? "#{remote}" : "LOCAL ONLY"
181
- end
182
168
  end
183
169
  end
184
170
  end
@@ -19,41 +19,58 @@ class Vagrantfile < CORL.plugin_class(:nucleon, :cloud_action)
19
19
  codes :vagrant_backup_failure,
20
20
  :vagrant_save_failure,
21
21
  :network_save_failure
22
+
23
+ register_bool :save
22
24
  end
23
25
  end
24
26
 
27
+ #---
28
+
29
+ def ignore
30
+ node_ignore
31
+ end
32
+
25
33
  #-----------------------------------------------------------------------------
26
34
  # Action operations
27
35
 
28
36
  def execute
29
- super do |node, network|
30
- info('corl.actions.vagrantfile.start')
31
-
32
- ensure_network(network) do
37
+ super do |node|
38
+ ensure_network do
33
39
  generated_vagrantfile_name = File.join(CORL.lib_path, 'core', 'vagrant', 'Vagrantfile')
34
40
  project_vagrantfile_name = File.join(network.directory, 'Vagrantfile')
35
41
  success = true
36
42
 
37
43
  corl_vagrantfile = Util::Disk.read(generated_vagrantfile_name)
38
44
 
39
- if File.exists?(project_vagrantfile_name)
40
- unless FileUtils.mv(project_vagrantfile_name, "#{project_vagrantfile_name}.backup", :force => true)
41
- myself.status = code.vagrant_backup_failure
42
- success = false
45
+ if settings[:save]
46
+ if File.exists?(project_vagrantfile_name)
47
+ backup_file = "#{project_vagrantfile_name}.backup"
48
+
49
+ unless FileUtils.mv(project_vagrantfile_name, backup_file, :force => true)
50
+ error('file_save', { :file => blue(backup_file) })
51
+ myself.status = code.vagrant_backup_failure
52
+ success = false
53
+ end
43
54
  end
44
- end
45
55
 
46
- if success
47
- unless Util::Disk.write(project_vagrantfile_name, corl_vagrantfile)
48
- myself.status = code.vagrant_save_failure
49
- success = false
50
- end
51
-
52
56
  if success
53
- unless network.save({ :files => 'Vagrantfile' })
54
- myself.status = code.network_save_failure
57
+ unless Util::Disk.write(project_vagrantfile_name, corl_vagrantfile)
58
+ error('file_save', { :file => blue(project_vagrantfile_name) })
59
+ myself.status = code.vagrant_save_failure
60
+ success = false
61
+ end
62
+
63
+ if success
64
+ if network.save({ :files => 'Vagrantfile', :remote => settings[:net_remote], :message => "Saving new Vagrantfile.", :allow_empty => true })
65
+ success('update', { :file => blue('Vagrantfile'), :remote_text => yellow(remote_message(settings[:net_remote])) })
66
+ else
67
+ error('update', { :file => blue('Vagrantfile') })
68
+ myself.status = code.network_save_failure
69
+ end
55
70
  end
56
71
  end
72
+ else
73
+ puts corl_vagrantfile
57
74
  end
58
75
  end
59
76
  end
@@ -2,7 +2,7 @@
2
2
  module Nucleon
3
3
  module Action
4
4
  module Node
5
- class IP < CORL.plugin_class(:nucleon, :cloud_action)
5
+ class IP < Nucleon.plugin_class(:nucleon, :cloud_action)
6
6
 
7
7
  #-----------------------------------------------------------------------------
8
8
  # Info
@@ -18,7 +18,7 @@ class IP < CORL.plugin_class(:nucleon, :cloud_action)
18
18
  # Operations
19
19
 
20
20
  def execute
21
- super do |node, network|
21
+ super do |node|
22
22
  ensure_node(node) do
23
23
  render(CORL.public_ip)
24
24
  end
@@ -2,7 +2,7 @@
2
2
  module Nucleon
3
3
  module Action
4
4
  module Node
5
- class SSH < CORL.plugin_class(:nucleon, :cloud_action)
5
+ class SSH < Nucleon.plugin_class(:nucleon, :cloud_action)
6
6
 
7
7
  #-----------------------------------------------------------------------------
8
8
  # Info
@@ -53,8 +53,8 @@ class SSH < CORL.plugin_class(:nucleon, :cloud_action)
53
53
  # Operations
54
54
 
55
55
  def execute
56
- super do |local_node, network|
57
- ensure_network(network) do
56
+ super do |local_node|
57
+ ensure_network do
58
58
  batch_success = network.batch(settings[:ssh_nodes], settings[:node_provider], false) do |node|
59
59
  render_options = { :id => node.id, :hostname => node.hostname }
60
60
 
@@ -2,7 +2,7 @@
2
2
  module Nucleon
3
3
  module Action
4
4
  module Node
5
- class Authorize < CORL.plugin_class(:nucleon, :cloud_action)
5
+ class Authorize < Nucleon.plugin_class(:nucleon, :cloud_action)
6
6
 
7
7
  #-----------------------------------------------------------------------------
8
8
  # Info
@@ -33,7 +33,7 @@ class Authorize < CORL.plugin_class(:nucleon, :cloud_action)
33
33
  # Operations
34
34
 
35
35
  def execute
36
- super do |node, network|
36
+ super do |node|
37
37
  info('corl.actions.authorize.start')
38
38
 
39
39
  ensure_node(node) do
@@ -2,7 +2,7 @@
2
2
  module Nucleon
3
3
  module Action
4
4
  module Node
5
- class Bootstrap < CORL.plugin_class(:nucleon, :cloud_action)
5
+ class Bootstrap < Nucleon.plugin_class(:nucleon, :cloud_action)
6
6
 
7
7
  #-----------------------------------------------------------------------------
8
8
  # Info
@@ -16,31 +16,18 @@ class Bootstrap < CORL.plugin_class(:nucleon, :cloud_action)
16
16
 
17
17
  def configure
18
18
  super do
19
- register :auth_files, :array, [] do |values|
20
- success = true
21
- values.each do |value|
22
- unless File.exists?(value)
23
- warn('corl.actions.bootstrap.errors.auth_files', { :value => value })
24
- success = false
25
- end
26
- end
27
- success
28
- end
29
- register :home_env_var, :str, 'HOME'
30
- register :home, :str, nil
31
- register :bootstrap_path, :str, File.join(CORL.lib_path, '..', 'bootstrap') do |value|
32
- unless File.directory?(value)
33
- warn('corl.actions.bootstrap.errors.bootstrap_path', { :value => value })
34
- next false
35
- end
36
- true
37
- end
38
- register :bootstrap_glob, :str, '**/*.sh'
39
- register :bootstrap_init, :str, 'bootstrap.sh'
19
+ register_directory :bootstrap_path, File.join(CORL.lib_path, '..', 'bootstrap')
20
+ register_files :auth_files
21
+
22
+ register_str :home_env_var, 'HOME'
23
+ register_str :home, nil
24
+
25
+ register_str :bootstrap_glob, '**/*.sh'
26
+ register_str :bootstrap_init, 'bootstrap.sh'
40
27
 
41
- register :bootstrap_nodes, :array, nil do |values|
28
+ register_array :bootstrap_nodes, nil do |values|
42
29
  if values.nil?
43
- warn('corl.actions.bootstrap.errors.bootstrap_nodes_empty')
30
+ warn('bootstrap_nodes_empty')
44
31
  next false
45
32
  end
46
33
 
@@ -50,7 +37,7 @@ class Bootstrap < CORL.plugin_class(:nucleon, :cloud_action)
50
37
  values.each do |value|
51
38
  if info = CORL.plugin_class(:CORL, :node).translate_reference(value)
52
39
  if ! node_plugins.keys.include?(info[:provider].to_sym) || info[:name].empty?
53
- warn('corl.actions.bootstrap.errors.bootstrap_nodes', { :value => value, :node_provider => info[:provider], :name => info[:name] })
40
+ warn('bootstrap_nodes', { :value => value, :node_provider => info[:provider], :name => info[:name] })
54
41
  success = false
55
42
  end
56
43
  end
@@ -74,18 +61,18 @@ class Bootstrap < CORL.plugin_class(:nucleon, :cloud_action)
74
61
  # Operations
75
62
 
76
63
  def execute
77
- super do |local_node, network|
78
- ensure_network(network) do
64
+ super do |local_node|
65
+ ensure_network do
79
66
  batch_success = network.batch(settings[:bootstrap_nodes], settings[:node_provider], settings[:parallel]) do |node|
80
67
  render_options = { :id => node.id, :hostname => node.hostname }
81
68
 
82
- info('corl.actions.bootstrap.start', render_options)
69
+ info('start', render_options)
83
70
  success = node.bootstrap(network.home, extended_config(:bootstrap, settings.clone))
84
71
  if success
85
- info('corl.actions.bootstrap.success', render_options)
72
+ success('complete', render_options)
86
73
  else
87
74
  render_options[:status] = node.status
88
- error('corl.actions.bootstrap.failure', render_options)
75
+ error('failure', render_options)
89
76
  end
90
77
  success
91
78
  end
@@ -2,7 +2,7 @@
2
2
  module Nucleon
3
3
  module Action
4
4
  module Node
5
- class Build < CORL.plugin_class(:nucleon, :cloud_action)
5
+ class Build < Nucleon.plugin_class(:nucleon, :cloud_action)
6
6
 
7
7
  #-----------------------------------------------------------------------------
8
8
  # Info
@@ -16,7 +16,7 @@ class Build < CORL.plugin_class(:nucleon, :cloud_action)
16
16
 
17
17
  def configure
18
18
  super do
19
- register :environment, :str, ''
19
+ register_str :environment
20
20
  end
21
21
  end
22
22
 
@@ -30,8 +30,8 @@ class Build < CORL.plugin_class(:nucleon, :cloud_action)
30
30
  # Operations
31
31
 
32
32
  def execute
33
- super do |node, network|
34
- info('corl.actions.build.start')
33
+ super do |node|
34
+ info('start')
35
35
  ensure_node(node) do
36
36
  settings.delete(:environment) if settings[:environment] == ''
37
37
 
@@ -2,9 +2,7 @@
2
2
  module Nucleon
3
3
  module Action
4
4
  module Node
5
- class Cache < CORL.plugin_class(:nucleon, :cloud_action)
6
-
7
- include Mixin::Action::Registration
5
+ class Cache < Nucleon.plugin_class(:nucleon, :cloud_action)
8
6
 
9
7
  #-----------------------------------------------------------------------------
10
8
  # Info
@@ -41,7 +39,7 @@ class Cache < CORL.plugin_class(:nucleon, :cloud_action)
41
39
  # Operations
42
40
 
43
41
  def execute
44
- super do |node, network|
42
+ super do |node|
45
43
  ensure_node(node) do
46
44
  if settings.delete(:clear, false)
47
45
  clear_node_cache(node)
@@ -2,7 +2,7 @@
2
2
  module Nucleon
3
3
  module Action
4
4
  module Node
5
- class Destroy < CORL.plugin_class(:nucleon, :cloud_action)
5
+ class Destroy < Nucleon.plugin_class(:nucleon, :cloud_action)
6
6
 
7
7
  #-----------------------------------------------------------------------------
8
8
  # Info
@@ -16,25 +16,9 @@ class Destroy < CORL.plugin_class(:nucleon, :cloud_action)
16
16
 
17
17
  def configure
18
18
  super do
19
- register :destroy_nodes, :array, nil do |values|
20
- if values.nil?
21
- warn('corl.actions.destroy.errors.destroy_nodes_empty')
22
- next false
23
- end
24
-
25
- node_plugins = CORL.loaded_plugins(:CORL, :node)
26
- success = true
27
-
28
- values.each do |value|
29
- if info = CORL.plugin_class(:CORL, :node).translate_reference(value)
30
- if ! node_plugins.keys.include?(info[:provider].to_sym) || info[:name].empty?
31
- warn('corl.actions.destroy.errors.destroy_nodes', { :value => value, :node_provider => info[:provider], :name => info[:name] })
32
- success = false
33
- end
34
- end
35
- end
36
- success
37
- end
19
+ register_bool :force, false
20
+
21
+ register_nodes :destroy_nodes
38
22
  end
39
23
  end
40
24
 
@@ -52,13 +36,28 @@ class Destroy < CORL.plugin_class(:nucleon, :cloud_action)
52
36
  # Operations
53
37
 
54
38
  def execute
55
- super do |local_node, network|
56
- ensure_network(network) do
57
- batch_success = network.batch(settings[:destroy_nodes], settings[:node_provider], settings[:parallel]) do |node|
58
- info('corl.actions.destroy.start', { :provider => node.plugin_provider, :name => node.plugin_name })
59
- node.destroy
39
+ super do |local_node|
40
+ ensure_network do
41
+ if settings[:force]
42
+ answer = 'YES'
43
+ else
44
+ message = render_message('prompt', { :operation => :ask }) + "\n\n"
45
+
46
+ array(settings[:destroy_nodes]).each do |hostname|
47
+ message << " #{hostname}\n"
48
+ end
49
+
50
+ message << "\n" + render_message('yes_query', { :operation => :ask, :yes => 'YES' }) + ' '
51
+ answer = ask(message)
52
+ end
53
+
54
+ if answer.upcase == 'YES'
55
+ batch_success = network.batch(settings[:destroy_nodes], settings[:node_provider], settings[:parallel]) do |node|
56
+ info('start', { :provider => node.plugin_provider, :name => node.plugin_name })
57
+ node.destroy
58
+ end
59
+ myself.status = code.batch_error unless batch_success
60
60
  end
61
- myself.status = code.batch_error unless batch_success
62
61
  end
63
62
  end
64
63
  end
@@ -2,7 +2,7 @@
2
2
  module Nucleon
3
3
  module Action
4
4
  module Node
5
- class Exec < CORL.plugin_class(:nucleon, :cloud_action)
5
+ class Exec < Nucleon.plugin_class(:nucleon, :cloud_action)
6
6
 
7
7
  #-----------------------------------------------------------------------------
8
8
  # Info
@@ -30,7 +30,7 @@ class Exec < CORL.plugin_class(:nucleon, :cloud_action)
30
30
  # Operations
31
31
 
32
32
  def execute
33
- super do |node, network|
33
+ super do |node|
34
34
  ensure_node(node) do
35
35
  if settings[:command].length > 1
36
36
  settings[:command].collect! do |value|
@@ -2,15 +2,13 @@
2
2
  module Nucleon
3
3
  module Action
4
4
  module Node
5
- class Fact < CORL.plugin_class(:nucleon, :cloud_action)
6
-
7
- include Mixin::Action::Registration
5
+ class Fact < Nucleon.plugin_class(:nucleon, :cloud_action)
8
6
 
9
7
  #-----------------------------------------------------------------------------
10
8
  # Info
11
9
 
12
10
  def self.describe(action = :fact, weight = 570)
13
- super(:node, action, weight)
11
+ describe_base(:node, action, weight, nil, nil, :node_fact)
14
12
  end
15
13
 
16
14
  #-----------------------------------------------------------------------------
@@ -43,7 +41,7 @@ class Fact < CORL.plugin_class(:nucleon, :cloud_action)
43
41
  # Operations
44
42
 
45
43
  def execute
46
- super do |node, network|
44
+ super do |node|
47
45
  ensure_node(node) do
48
46
  if ! settings[:name] || settings[:name].empty?
49
47
  render_node_facts(node)
@@ -113,6 +111,13 @@ class Fact < CORL.plugin_class(:nucleon, :cloud_action)
113
111
  myself.status = code.fact_save_failed
114
112
  end
115
113
  end
114
+
115
+ #-----------------------------------------------------------------------------
116
+ # Output
117
+
118
+ def render_provider
119
+ :node_fact
120
+ end
116
121
  end
117
122
  end
118
123
  end
@@ -2,15 +2,13 @@
2
2
  module Nucleon
3
3
  module Action
4
4
  module Node
5
- class Group < CORL.plugin_class(:nucleon, :cloud_action)
6
-
7
- include Mixin::Action::Registration
5
+ class Group < Nucleon.plugin_class(:nucleon, :cloud_action)
8
6
 
9
7
  #-----------------------------------------------------------------------------
10
8
  # Info
11
9
 
12
10
  def self.describe(action = :group, weight = 670)
13
- super(:node, action, weight)
11
+ describe_base(:node, action, weight, nil, nil, :node_group)
14
12
  end
15
13
 
16
14
  #-----------------------------------------------------------------------------
@@ -41,7 +39,7 @@ class Group < CORL.plugin_class(:nucleon, :cloud_action)
41
39
  # Operations
42
40
 
43
41
  def execute
44
- super do |node, network|
42
+ super do |node|
45
43
  ensure_node(node) do
46
44
  if ! settings[:name] || settings[:name].empty?
47
45
  render_node_groups(node)
@@ -109,6 +107,13 @@ class Group < CORL.plugin_class(:nucleon, :cloud_action)
109
107
  myself.status = code.group_save_failed
110
108
  end
111
109
  end
110
+
111
+ #-----------------------------------------------------------------------------
112
+ # Output
113
+
114
+ def render_provider
115
+ :node_group
116
+ end
112
117
  end
113
118
  end
114
119
  end
@@ -2,10 +2,8 @@
2
2
  module Nucleon
3
3
  module Action
4
4
  module Node
5
- class Identity < CORL.plugin_class(:nucleon, :cloud_action)
6
-
7
- include Mixin::Action::Registration
8
-
5
+ class Identity < Nucleon.plugin_class(:nucleon, :cloud_action)
6
+
9
7
  #-----------------------------------------------------------------------------
10
8
  # Info
11
9
 
@@ -20,7 +18,7 @@ class Identity < CORL.plugin_class(:nucleon, :cloud_action)
20
18
  super do
21
19
  codes :identity_upload_failure
22
20
 
23
- register :name, :str
21
+ register_str :name
24
22
  register_project :identity
25
23
  register_nodes :identity_nodes
26
24
  end
@@ -40,15 +38,15 @@ class Identity < CORL.plugin_class(:nucleon, :cloud_action)
40
38
  # Operations
41
39
 
42
40
  def execute
43
- super do |local_node, network|
44
- ensure_network(network) do
41
+ super do |local_node|
42
+ ensure_network do
45
43
  builder = network.identity_builder({ settings[:name] => settings[:identity] })
46
44
 
47
45
  if builder.build(local_node)
48
46
  identity_directory = File.join(builder.build_directory, settings[:name])
49
47
 
50
48
  success = network.batch(settings[:identity_nodes], settings[:node_provider], settings[:parallel]) do |node|
51
- info('corl.actions.identity.start', { :provider => node.plugin_provider, :name => node.plugin_name })
49
+ info('start', { :provider => node.plugin_provider, :name => node.plugin_name })
52
50
 
53
51
  remote_network_directory = node.lookup(:corl_network)
54
52
 
@@ -2,7 +2,7 @@
2
2
  module Nucleon
3
3
  module Action
4
4
  module Node
5
- class Image < CORL.plugin_class(:nucleon, :cloud_action)
5
+ class Image < Nucleon.plugin_class(:nucleon, :cloud_action)
6
6
 
7
7
  #-----------------------------------------------------------------------------
8
8
  # Info
@@ -52,8 +52,8 @@ class Image < CORL.plugin_class(:nucleon, :cloud_action)
52
52
  # Operations
53
53
 
54
54
  def execute
55
- super do |local_node, network|
56
- ensure_network(network) do
55
+ super do |local_node|
56
+ ensure_network do
57
57
  batch_success = network.batch(settings[:image_nodes], settings[:node_provider], settings[:parallel]) do |node|
58
58
  info('corl.actions.image.start', { :provider => node.plugin_provider, :name => node.plugin_name })
59
59
  node.create_image