poolparty 0.2.69 → 0.2.84

Sign up to get free protection for your applications and to get access to all the features.
Files changed (298) hide show
  1. data/Capfile +1 -0
  2. data/History.txt +6 -0
  3. data/Manifest.txt +140 -143
  4. data/PostInstall.txt +1 -1
  5. data/README.txt +2 -0
  6. data/bin/cloud-configure +5 -2
  7. data/bin/cloud-handle-load +3 -3
  8. data/bin/cloud-maintain +3 -3
  9. data/bin/cloud-provision +6 -5
  10. data/bin/cloud-rsync +28 -0
  11. data/bin/cloud-setup-dev +25 -0
  12. data/bin/cloud-spec +40 -0
  13. data/bin/cloud-start +5 -3
  14. data/bin/server-clean-cert-for +15 -0
  15. data/bin/server-rerun +0 -1
  16. data/bin/server-start-client +1 -1
  17. data/bin/server-start-master +1 -1
  18. data/bin/server-start-node +1 -1
  19. data/bin/server-update-hosts +4 -3
  20. data/bin/server-write-new-nodes +26 -0
  21. data/generators/poolspec/USAGE +2 -2
  22. data/generators/poolspec/poolspec_generator.rb +1 -1
  23. data/lib/erlang/messenger/Makefile +15 -0
  24. data/lib/erlang/messenger/ebin/client_app.beam +0 -0
  25. data/lib/erlang/messenger/ebin/client_server.beam +0 -0
  26. data/lib/erlang/messenger/ebin/erl_crash.dump +10326 -0
  27. data/lib/erlang/messenger/ebin/master_app.beam +0 -0
  28. data/lib/erlang/messenger/ebin/node_app.beam +0 -0
  29. data/lib/erlang/messenger/ebin/pm_client.beam +0 -0
  30. data/lib/erlang/messenger/ebin/pm_client_old.beam +0 -0
  31. data/lib/erlang/messenger/ebin/pm_client_supervisor.beam +0 -0
  32. data/lib/erlang/messenger/ebin/pm_cluster.beam +0 -0
  33. data/lib/erlang/messenger/ebin/pm_event_manager.beam +0 -0
  34. data/lib/erlang/messenger/ebin/pm_master.beam +0 -0
  35. data/lib/erlang/messenger/ebin/pm_master_event_handler.beam +0 -0
  36. data/lib/erlang/messenger/ebin/pm_master_supervisor.beam +0 -0
  37. data/lib/erlang/messenger/ebin/pm_node.beam +0 -0
  38. data/lib/erlang/messenger/ebin/pm_node_supervisor.beam +0 -0
  39. data/lib/erlang/messenger/ebin/pm_packager.beam +0 -0
  40. data/lib/erlang/messenger/ebin/pm_spawner.beam +0 -0
  41. data/lib/erlang/messenger/ebin/pm_strings.beam +0 -0
  42. data/lib/erlang/messenger/ebin/utils.beam +0 -0
  43. data/lib/erlang/messenger/lib/eunit/Makefile +28 -0
  44. data/lib/erlang/messenger/lib/eunit/ebin/autoload.beam +0 -0
  45. data/lib/erlang/messenger/lib/eunit/ebin/code_monitor.beam +0 -0
  46. data/lib/erlang/messenger/lib/eunit/ebin/eunit.beam +0 -0
  47. data/lib/erlang/messenger/lib/eunit/ebin/eunit_autoexport.beam +0 -0
  48. data/lib/erlang/messenger/lib/eunit/ebin/eunit_data.beam +0 -0
  49. data/lib/erlang/messenger/lib/eunit/ebin/eunit_lib.beam +0 -0
  50. data/lib/erlang/messenger/lib/eunit/ebin/eunit_proc.beam +0 -0
  51. data/lib/erlang/messenger/lib/eunit/ebin/eunit_serial.beam +0 -0
  52. data/lib/erlang/messenger/lib/eunit/ebin/eunit_server.beam +0 -0
  53. data/lib/erlang/messenger/lib/eunit/ebin/eunit_striptests.beam +0 -0
  54. data/lib/erlang/messenger/lib/eunit/ebin/eunit_test.beam +0 -0
  55. data/lib/erlang/messenger/lib/eunit/ebin/eunit_tests.beam +0 -0
  56. data/lib/erlang/messenger/lib/eunit/ebin/eunit_tty.beam +0 -0
  57. data/lib/erlang/messenger/lib/eunit/ebin/file_monitor.beam +0 -0
  58. data/lib/erlang/messenger/lib/eunit/src/Makefile +46 -0
  59. data/lib/erlang/messenger/src/pm_master.erl +5 -0
  60. data/lib/erlang/messenger/src/pm_node.erl +2 -3
  61. data/lib/erlang/messenger/src/pm_spawner.erl +213 -0
  62. data/lib/poolparty/base_packages/heartbeat.rb +57 -43
  63. data/lib/poolparty/base_packages/poolparty.rb +18 -15
  64. data/lib/poolparty/capistrano.rb +18 -0
  65. data/lib/poolparty/core/class.rb +24 -0
  66. data/lib/poolparty/core/kernel.rb +7 -0
  67. data/lib/poolparty/core/module.rb +2 -2
  68. data/lib/poolparty/core/string.rb +1 -1
  69. data/lib/poolparty/dependency_resolutions/puppet.rb +10 -2
  70. data/lib/poolparty/exceptions/ProvisionerException.rb +5 -0
  71. data/lib/poolparty/extra/deployments.rb +31 -0
  72. data/lib/poolparty/helpers/binary.rb +14 -2
  73. data/lib/poolparty/helpers/optioner.rb +61 -22
  74. data/lib/poolparty/helpers/ruberl.rb +33 -0
  75. data/lib/poolparty/modules/cloud_dsl.rb +2 -1
  76. data/lib/poolparty/modules/cloud_resourcer.rb +30 -6
  77. data/lib/poolparty/modules/configurable.rb +2 -0
  78. data/lib/poolparty/modules/file_writer.rb +4 -4
  79. data/lib/poolparty/modules/resourcing_dsl.rb +5 -5
  80. data/lib/poolparty/monitors/base_monitor.rb +1 -1
  81. data/lib/poolparty/monitors/monitors/cpu_monitor.rb +2 -2
  82. data/lib/poolparty/net/messenger.rb +1 -1
  83. data/lib/poolparty/net/remote.rb +2 -2
  84. data/lib/poolparty/net/remote_bases/ec2.rb +51 -11
  85. data/lib/poolparty/net/remote_instance.rb +7 -3
  86. data/lib/poolparty/net/remoter.rb +72 -24
  87. data/lib/poolparty/net/remoter_base.rb +10 -0
  88. data/lib/poolparty/plugins/deploydirectory.rb +10 -5
  89. data/lib/poolparty/plugins/git.rb +51 -0
  90. data/lib/poolparty/{pool → poolparty}/base.rb +4 -2
  91. data/lib/poolparty/{pool → poolparty}/cloud.rb +32 -10
  92. data/lib/poolparty/{pool → poolparty}/plugin_model.rb +4 -4
  93. data/lib/poolparty/{pool → poolparty}/pool.rb +2 -2
  94. data/lib/poolparty/{pool → poolparty}/resource.rb +33 -15
  95. data/lib/poolparty/{pool → poolparty}/resources/class_package.rb +3 -3
  96. data/lib/poolparty/{pool → poolparty}/resources/directory.rb +6 -3
  97. data/lib/poolparty/{pool → poolparty}/resources/exec.rb +2 -5
  98. data/lib/poolparty/{pool → poolparty}/resources/file.rb +3 -3
  99. data/lib/poolparty/{pool → poolparty}/resources/package.rb +1 -1
  100. data/lib/poolparty/{pool → poolparty}/resources/remote_file.rb +1 -1
  101. data/lib/poolparty/poolparty/resources/remote_user.rb +17 -0
  102. data/lib/poolparty/{pool → poolparty}/resources/sshkey.rb +5 -1
  103. data/lib/poolparty/{pool → poolparty}/script.rb +1 -1
  104. data/lib/poolparty/provisioners/capistrano/capistrano.rb +127 -0
  105. data/lib/poolparty/provisioners/capistrano/capistrano_configurer.rb +58 -0
  106. data/lib/poolparty/provisioners/capistrano/recipies/base.rb +104 -0
  107. data/lib/poolparty/provisioners/capistrano/recipies/master.rb +121 -0
  108. data/lib/poolparty/provisioners/capistrano/recipies/slave.rb +12 -0
  109. data/lib/poolparty/provisioners/provisioner_base.rb +204 -0
  110. data/lib/poolparty/spec/core/string.rb +16 -0
  111. data/lib/poolparty/spec/matchers/a_spec_extensions_base.rb +26 -0
  112. data/lib/poolparty/spec/matchers/have_cron.rb +28 -0
  113. data/lib/poolparty/spec/matchers/have_deploydirectory.rb +15 -0
  114. data/lib/poolparty/spec/matchers/have_directory.rb +31 -0
  115. data/lib/poolparty/spec/matchers/have_exec.rb +28 -0
  116. data/lib/poolparty/spec/matchers/have_file.rb +28 -0
  117. data/lib/poolparty/spec/matchers/have_gempackage.rb +28 -0
  118. data/lib/poolparty/spec/matchers/have_git.rb +28 -0
  119. data/lib/poolparty/spec/matchers/have_host.rb +28 -0
  120. data/lib/poolparty/spec/matchers/have_mount.rb +28 -0
  121. data/lib/poolparty/spec/matchers/have_package.rb +28 -0
  122. data/lib/poolparty/spec/matchers/have_remotefile.rb +28 -0
  123. data/lib/poolparty/spec/matchers/have_rsyncmirror.rb +28 -0
  124. data/lib/poolparty/spec/matchers/have_service.rb +28 -0
  125. data/lib/poolparty/spec/matchers/have_sshkey.rb +28 -0
  126. data/lib/poolparty/spec/matchers/have_symlink.rb +28 -0
  127. data/lib/poolparty/spec/matchers/have_variable.rb +32 -0
  128. data/lib/poolparty/spec/spec/dynamic_matchers.rb +63 -0
  129. data/lib/poolparty/spec/spec/ensure_matchers_exist.rb +7 -0
  130. data/lib/poolparty/spec/templates/have_base.rb +28 -0
  131. data/lib/poolparty/templates/authkeys +1 -1
  132. data/lib/poolparty/templates/gem +12 -10
  133. data/lib/poolparty/templates/ha.cf +9 -11
  134. data/lib/poolparty/templates/haresources +1 -1
  135. data/lib/poolparty/templates/logd.cf +42 -0
  136. data/lib/poolparty/templates/puppet.conf +18 -8
  137. data/lib/poolparty/templates/puppetcleaner +9 -3
  138. data/lib/poolparty/templates/puppetrerun +16 -3
  139. data/lib/poolparty/templates/puppetrunner +1 -1
  140. data/lib/poolparty/version.rb +1 -1
  141. data/lib/poolparty.rb +12 -8
  142. data/lib/poolpartyspec.rb +34 -0
  143. data/poolparty.gemspec +151 -149
  144. data/spec/poolparty/aska/aska_spec.rb +0 -5
  145. data/spec/poolparty/bin/console_spec.rb +3 -0
  146. data/spec/poolparty/extra/deployments_spec.rb +64 -0
  147. data/spec/poolparty/helpers/binary_spec.rb +1 -1
  148. data/spec/poolparty/helpers/optioner_spec.rb +17 -4
  149. data/spec/poolparty/modules/cloud_resourcer_spec.rb +19 -2
  150. data/spec/poolparty/modules/configurable_spec.rb +2 -2
  151. data/spec/poolparty/net/remote_bases/ec2_spec.rb +5 -2
  152. data/spec/poolparty/net/remote_instance_spec.rb +5 -0
  153. data/spec/poolparty/net/remote_spec.rb +24 -31
  154. data/spec/poolparty/net/remoter_base_spec.rb +11 -6
  155. data/spec/poolparty/net/remoter_spec.rb +55 -27
  156. data/spec/poolparty/plugins/deploydirectory_spec.rb +1 -0
  157. data/spec/poolparty/plugins/git_spec.rb +45 -0
  158. data/spec/poolparty/{pool → poolparty}/cloud_spec.rb +41 -0
  159. data/spec/poolparty/{pool → poolparty}/plugin_spec.rb +1 -1
  160. data/spec/poolparty/{pool → poolparty}/pool_spec.rb +1 -1
  161. data/spec/poolparty/{pool → poolparty}/resource_spec.rb +15 -2
  162. data/spec/poolparty/poolparty/resources/user_spec.rb +38 -0
  163. data/spec/poolparty/poolparty/test_plugins/virtual_host_template.erb +0 -0
  164. data/spec/poolparty/poolparty_spec.rb +1 -1
  165. data/spec/poolparty/provisioners/capistrano/capistrano_spec.rb +27 -0
  166. data/spec/poolparty/provisioners/provisioner_base_spec.rb +120 -0
  167. data/spec/poolparty/spec/core/string_spec.rb +57 -0
  168. data/spec/poolparty/spec_helper.rb +48 -6
  169. data/tasks/deployment.rake +3 -5
  170. data/tasks/spec.rake +2 -3
  171. data/website/index.html +2 -2
  172. metadata +150 -148
  173. data/lib/erlang/messenger/lib/eunit/.svn/all-wcprops +0 -53
  174. data/lib/erlang/messenger/lib/eunit/.svn/entries +0 -140
  175. data/lib/erlang/messenger/lib/eunit/.svn/format +0 -1
  176. data/lib/erlang/messenger/lib/eunit/.svn/prop-base/NOTES.svn-base +0 -5
  177. data/lib/erlang/messenger/lib/eunit/.svn/text-base/AUTHORS.svn-base +0 -2
  178. data/lib/erlang/messenger/lib/eunit/.svn/text-base/CHANGELOG.svn-base +0 -14
  179. data/lib/erlang/messenger/lib/eunit/.svn/text-base/COPYING.svn-base +0 -504
  180. data/lib/erlang/messenger/lib/eunit/.svn/text-base/NOTES.svn-base +0 -276
  181. data/lib/erlang/messenger/lib/eunit/.svn/text-base/README.svn-base +0 -3
  182. data/lib/erlang/messenger/lib/eunit/.svn/text-base/sys.config.svn-base +0 -9
  183. data/lib/erlang/messenger/lib/eunit/.svn/text-base/vsn.mk.svn-base +0 -1
  184. data/lib/erlang/messenger/lib/eunit/doc/.svn/all-wcprops +0 -59
  185. data/lib/erlang/messenger/lib/eunit/doc/.svn/entries +0 -142
  186. data/lib/erlang/messenger/lib/eunit/doc/.svn/format +0 -1
  187. data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/erlang.png.svn-base +0 -5
  188. data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/eunit.html.svn-base +0 -5
  189. data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/index.html.svn-base +0 -5
  190. data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/modules-frame.html.svn-base +0 -5
  191. data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/overview-summary.html.svn-base +0 -5
  192. data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/packages-frame.html.svn-base +0 -5
  193. data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/edoc-info.svn-base +0 -3
  194. data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/erlang.png.svn-base +0 -0
  195. data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/eunit.html.svn-base +0 -172
  196. data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/index.html.svn-base +0 -17
  197. data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/modules-frame.html.svn-base +0 -12
  198. data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/overview-summary.html.svn-base +0 -984
  199. data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/overview.edoc.svn-base +0 -980
  200. data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/packages-frame.html.svn-base +0 -11
  201. data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/stylesheet.css.svn-base +0 -55
  202. data/lib/erlang/messenger/lib/eunit/ebin/.svn/all-wcprops +0 -5
  203. data/lib/erlang/messenger/lib/eunit/ebin/.svn/dir-prop-base +0 -8
  204. data/lib/erlang/messenger/lib/eunit/ebin/.svn/entries +0 -28
  205. data/lib/erlang/messenger/lib/eunit/ebin/.svn/format +0 -1
  206. data/lib/erlang/messenger/lib/eunit/examples/.svn/all-wcprops +0 -23
  207. data/lib/erlang/messenger/lib/eunit/examples/.svn/entries +0 -66
  208. data/lib/erlang/messenger/lib/eunit/examples/.svn/format +0 -1
  209. data/lib/erlang/messenger/lib/eunit/examples/.svn/prop-base/eunit_examples.erl.svn-base +0 -5
  210. data/lib/erlang/messenger/lib/eunit/examples/.svn/prop-base/fib.erl.svn-base +0 -5
  211. data/lib/erlang/messenger/lib/eunit/examples/.svn/text-base/eunit_examples.erl.svn-base +0 -339
  212. data/lib/erlang/messenger/lib/eunit/examples/.svn/text-base/fib.erl.svn-base +0 -19
  213. data/lib/erlang/messenger/lib/eunit/examples/.svn/text-base/tests.txt.svn-base +0 -1
  214. data/lib/erlang/messenger/lib/eunit/include/.svn/all-wcprops +0 -11
  215. data/lib/erlang/messenger/lib/eunit/include/.svn/entries +0 -41
  216. data/lib/erlang/messenger/lib/eunit/include/.svn/format +0 -1
  217. data/lib/erlang/messenger/lib/eunit/include/.svn/prop-base/eunit.hrl.svn-base +0 -5
  218. data/lib/erlang/messenger/lib/eunit/include/.svn/text-base/eunit.hrl.svn-base +0 -313
  219. data/lib/erlang/messenger/lib/eunit/src/.svn/all-wcprops +0 -113
  220. data/lib/erlang/messenger/lib/eunit/src/.svn/entries +0 -259
  221. data/lib/erlang/messenger/lib/eunit/src/.svn/format +0 -1
  222. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/autoload.erl.svn-base +0 -5
  223. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/code_monitor.erl.svn-base +0 -5
  224. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit.erl.svn-base +0 -5
  225. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_autoexport.erl.svn-base +0 -5
  226. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_data.erl.svn-base +0 -5
  227. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_internal.hrl.svn-base +0 -5
  228. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_lib.erl.svn-base +0 -5
  229. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_proc.erl.svn-base +0 -5
  230. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_serial.erl.svn-base +0 -5
  231. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_server.erl.svn-base +0 -5
  232. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_striptests.erl.svn-base +0 -5
  233. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_test.erl.svn-base +0 -5
  234. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_tests.erl.svn-base +0 -5
  235. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_tty.erl.svn-base +0 -5
  236. data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/file_monitor.erl.svn-base +0 -5
  237. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/autoload.erl.svn-base +0 -388
  238. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/code_monitor.erl.svn-base +0 -243
  239. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit.app.src.svn-base +0 -21
  240. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit.appup.src.svn-base +0 -1
  241. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit.erl.svn-base +0 -196
  242. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_autoexport.erl.svn-base +0 -102
  243. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_data.erl.svn-base +0 -798
  244. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_internal.hrl.svn-base +0 -48
  245. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_lib.erl.svn-base +0 -682
  246. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_proc.erl.svn-base +0 -552
  247. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_serial.erl.svn-base +0 -157
  248. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_server.erl.svn-base +0 -340
  249. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_striptests.erl.svn-base +0 -64
  250. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_test.erl.svn-base +0 -334
  251. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_tests.erl.svn-base +0 -45
  252. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_tty.erl.svn-base +0 -272
  253. data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/file_monitor.erl.svn-base +0 -409
  254. data/lib/erlang/messenger/src/pm_client_old.erl +0 -52
  255. data/lib/poolparty/helpers/provisioner_base.rb +0 -346
  256. data/lib/poolparty/helpers/provisioners/master.rb +0 -205
  257. data/lib/poolparty/helpers/provisioners/slave.rb +0 -64
  258. data/spec/poolparty/helpers/provisioner_base_spec.rb +0 -134
  259. data/spec/poolparty/helpers/provisioners/master_spec.rb +0 -54
  260. data/spec/poolparty/helpers/provisioners/slave_spec.rb +0 -28
  261. /data/lib/poolparty/{pool → poolparty}/custom_resource.rb +0 -0
  262. /data/lib/poolparty/{pool → poolparty}/loggable.rb +0 -0
  263. /data/lib/poolparty/{pool → poolparty}/plugin.rb +0 -0
  264. /data/lib/poolparty/{pool → poolparty}/resources/conditional.rb +0 -0
  265. /data/lib/poolparty/{pool → poolparty}/resources/cron.rb +0 -0
  266. /data/lib/poolparty/{pool → poolparty}/resources/custom_service.rb +0 -0
  267. /data/lib/poolparty/{pool → poolparty}/resources/gem_package.rb +0 -0
  268. /data/lib/poolparty/{pool → poolparty}/resources/host.rb +0 -0
  269. /data/lib/poolparty/{pool → poolparty}/resources/mount.rb +0 -0
  270. /data/lib/poolparty/{pool → poolparty}/resources/service.rb +0 -0
  271. /data/lib/poolparty/{pool → poolparty}/resources/symlink.rb +0 -0
  272. /data/lib/poolparty/{pool → poolparty}/resources/variable.rb +0 -0
  273. /data/log/{pool.logs → pool.log} +0 -0
  274. /data/spec/poolparty/{pool/test_plugins/virtual_host_template.erb → net/log/pool.log} +0 -0
  275. /data/spec/poolparty/{pool → poolparty}/base_spec.rb +0 -0
  276. /data/spec/poolparty/{pool → poolparty}/configurers/files/ruby_basic.rb +0 -0
  277. /data/spec/poolparty/{pool → poolparty}/configurers/files/ruby_plugins.rb +0 -0
  278. /data/spec/poolparty/{pool → poolparty}/configurers/ruby_spec.rb +0 -0
  279. /data/spec/poolparty/{pool → poolparty}/custom_resource_spec.rb +0 -0
  280. /data/spec/poolparty/{pool → poolparty}/example_spec.rb +0 -0
  281. /data/spec/poolparty/{pool → poolparty}/plugin_model_spec.rb +0 -0
  282. /data/spec/poolparty/{pool → poolparty}/resources/class_package_spec.rb +0 -0
  283. /data/spec/poolparty/{pool → poolparty}/resources/conditional_spec.rb +0 -0
  284. /data/spec/poolparty/{pool → poolparty}/resources/cron_spec.rb +0 -0
  285. /data/spec/poolparty/{pool → poolparty}/resources/directory_spec.rb +0 -0
  286. /data/spec/poolparty/{pool → poolparty}/resources/exec_spec.rb +0 -0
  287. /data/spec/poolparty/{pool → poolparty}/resources/file_spec.rb +0 -0
  288. /data/spec/poolparty/{pool → poolparty}/resources/gem_spec.rb +0 -0
  289. /data/spec/poolparty/{pool → poolparty}/resources/host_spec.rb +0 -0
  290. /data/spec/poolparty/{pool → poolparty}/resources/package_spec.rb +0 -0
  291. /data/spec/poolparty/{pool → poolparty}/resources/remote_file_spec.rb +0 -0
  292. /data/spec/poolparty/{pool → poolparty}/resources/service_spec.rb +0 -0
  293. /data/spec/poolparty/{pool → poolparty}/resources/sshkey_spec.rb +0 -0
  294. /data/spec/poolparty/{pool → poolparty}/resources/symlink_spec.rb +0 -0
  295. /data/spec/poolparty/{pool → poolparty}/resources/variable_spec.rb +0 -0
  296. /data/spec/poolparty/{pool → poolparty}/script_spec.rb +0 -0
  297. /data/spec/poolparty/{pool → poolparty}/test_plugins/sshkey_test +0 -0
  298. /data/spec/poolparty/{pool → poolparty}/test_plugins/webserver.rb +0 -0
@@ -0,0 +1,28 @@
1
+
2
+ APPNAME=eunit
3
+
4
+ SUB_DIRECTORIES = src
5
+
6
+ include vsn.mk
7
+
8
+ DOC_OPTS={def,{version,\"$(EUNIT_VSN)\"}}
9
+
10
+
11
+ all: subdirs
12
+
13
+ subdirs:
14
+ @for d in $(SUB_DIRECTORIES); do \
15
+ (cd $$d; $(MAKE)); \
16
+ done
17
+
18
+ clean:
19
+ @for d in $(SUB_DIRECTORIES); do \
20
+ (cd $$d; $(MAKE) clean); \
21
+ done
22
+
23
+ docs:
24
+ erl -noshell -eval "edoc:application($(APPNAME), \".\", [$(DOC_OPTS)])" -s init stop
25
+
26
+ test: subdirs
27
+ @echo Testing...
28
+ @erl -noshell -pa ebin -s eunit test -s init stop
@@ -0,0 +1,46 @@
1
+
2
+ include ../vsn.mk
3
+
4
+ EMULATOR=beam
5
+ EBIN=../ebin
6
+ INCLUDE=../include
7
+
8
+ APP_TARGET=$(EBIN)/eunit.app
9
+ APPUP_TARGET=$(EBIN)/eunit.appup
10
+
11
+ ERL_COMPILE_FLAGS += -I$(INCLUDE) +warn_unused_vars +nowarn_shadow_vars +warn_unused_import
12
+
13
+ SOURCES= \
14
+ eunit_autoexport.erl \
15
+ eunit_striptests.erl \
16
+ eunit.erl \
17
+ eunit_tests.erl \
18
+ eunit_server.erl \
19
+ eunit_proc.erl \
20
+ eunit_serial.erl \
21
+ eunit_test.erl \
22
+ eunit_lib.erl \
23
+ eunit_data.erl \
24
+ eunit_tty.erl \
25
+ code_monitor.erl \
26
+ file_monitor.erl \
27
+ autoload.erl
28
+
29
+ OBJECTS=$(SOURCES:%.erl=$(EBIN)/%.$(EMULATOR)) $(APP_TARGET) $(APPUP_TARGET)
30
+
31
+ all: $(OBJECTS)
32
+
33
+ $(OBJECTS): eunit_internal.hrl \
34
+ $(INCLUDE)/eunit.hrl
35
+
36
+ clean:
37
+ rm -f $(OBJECTS)
38
+
39
+ $(EBIN)/%.$(EMULATOR):%.erl
40
+ erlc -pa $(EBIN) -W $(ERL_COMPILE_FLAGS) -o$(EBIN) $<
41
+
42
+ $(APP_TARGET): eunit.app.src ../vsn.mk
43
+ sed -e 's;%VSN%;$(EUNIT_VSN);' $< > $@
44
+
45
+ $(APPUP_TARGET): eunit.appup.src ../vsn.mk
46
+ sed -e 's;%VSN%;$(EUNIT_VSN);' $< > $@
@@ -105,6 +105,11 @@ handle_call({get_current_load, Types}, _From, State) ->
105
105
  LoadForType = [utils:average_of_list(get_load_for_type(Type, State)) || Type <- Types],
106
106
  ?TRACE("LoadForType: ",[LoadForType]),
107
107
  {reply, LoadForType, State};
108
+ % Handle puppet needs
109
+ handle_call({clear_cert_for, Name}, _From, State) ->
110
+ String = string:concat(". /etc/profile && /usr/bin/puppetcleaner ",Name),
111
+ os:cmd(String),
112
+ {reply, ok, State};
108
113
  handle_call({get_current_nodes, _Args}, _From, State) ->
109
114
  {reply, get_live_nodes(State), State}.
110
115
 
@@ -133,7 +133,7 @@ init(Args) ->
133
133
  %% Description: Handling call messages
134
134
  %%--------------------------------------------------------------------
135
135
  handle_call({run_command, Cmd}, _From, State) ->
136
- Reply = os:cmd(". /etc/profile && server-fire-cmd \""++Cmd++"\""),
136
+ Reply = os:cmd(Cmd),
137
137
  {reply, Reply, State};
138
138
  handle_call({update_load, Type, Load}, _From, State) ->
139
139
  {Type, NewState} = store_load_for_type(Type, Load, State),
@@ -197,5 +197,4 @@ code_change(_OldVsn, State, _Extra) ->
197
197
  {ok, State}.
198
198
 
199
199
  % Private
200
- server_location() ->
201
- global:whereis_name(node()).
200
+ server_location() -> global:whereis_name(node()).
@@ -0,0 +1,213 @@
1
+ %
2
+ % pm_spawner.erl
3
+ % Spawn a process in this gen_server remotely
4
+ % and hear back from it when it's got stuff to say
5
+ %
6
+ % Created by Ari Lerner on 2008-12-05.
7
+ % Copyright 2008 CitrusByte. All rights reserved.
8
+ %
9
+ -module (pm_spawner).
10
+ -behaviour(gen_server).
11
+
12
+ -include_lib("../include/defines.hrl").
13
+
14
+ %% API
15
+ -export([start_link/0]).
16
+ -export ([run_command/1, run_command/2, check_command/1]).
17
+
18
+ %% gen_server callbacks
19
+ -export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2, code_change/3]).
20
+
21
+ -record(state, {
22
+ processes = ?DICT:new() % Array of the output
23
+ }).
24
+ -define(SERVER, ?MODULE).
25
+
26
+ %%--------------------------------------------------------------------
27
+ %% Function: start_link() -> {ok,Pid} | ignore | {error,Error}
28
+ %% Description: Starts the server
29
+ %%--------------------------------------------------------------------
30
+ start_link() -> gen_server:start_link({global, ?MODULE}, ?MODULE, [], []).
31
+
32
+ %%====================================================================
33
+ %% gen_server callbacks
34
+ %%====================================================================
35
+
36
+ %%--------------------------------------------------------------------
37
+ %% Function: init(Args) -> {ok, State} |
38
+ %% {ok, State, Timeout} |
39
+ %% ignore |
40
+ %% {stop, Reason}
41
+ %% Description: Initiates the server
42
+ %%--------------------------------------------------------------------
43
+ init([]) ->
44
+ % process_flag(trap_exit, true),
45
+ {ok, #state{
46
+ processes = ?DICT:new()
47
+ }}.
48
+
49
+ %%--------------------------------------------------------------------
50
+ %% Function: %% handle_call(Request, From, State) -> {reply, Reply, State} |
51
+ %% {reply, Reply, State, Timeout} |
52
+ %% {noreply, State} |
53
+ %% {noreply, State, Timeout} |
54
+ %% {stop, Reason, Reply, State} |
55
+ %% {stop, Reason, State}
56
+ %% Description: Handling call messages
57
+ %%--------------------------------------------------------------------
58
+ handle_call({run_command, Cmds}, _From, State) ->
59
+ {ok, NewState} = run_command(Cmds, State),
60
+ ?TRACE("storing into state from call", [Cmds, NewState]),
61
+ {reply, ok, NewState};
62
+ handle_call({check_command, Cmd}, _From, State) ->
63
+ AtomCommand = erlang:list_to_atom(Cmd),
64
+ ?TRACE("is_key for ", [AtomCommand, ?DICT:is_key(AtomCommand, State#state.processes)]),
65
+ case ?DICT:is_key(AtomCommand, State#state.processes) of
66
+ false ->
67
+ Reply = nil,
68
+ NewState = State;
69
+ true ->
70
+ Pid = ?DICT:fetch(AtomCommand, State#state.processes),
71
+ case erlang:is_pid(Pid) of
72
+ true ->
73
+ Pid ! {self(), collect},
74
+ receive
75
+ {command_response, OutFromCommand} ->
76
+ Reply = OutFromCommand,
77
+ NewState = State#state{processes = ?DICT:store(AtomCommand, OutFromCommand, State#state.processes)};
78
+ Msg ->
79
+ NewState = State,
80
+ Reply = Msg
81
+ after
82
+ 1000 ->
83
+ Pid ! {self(), collect},
84
+ NewState = State,
85
+ Reply = "no output"
86
+ end;
87
+ false ->
88
+ NewState = State,
89
+ Reply = Pid
90
+ end
91
+ end,
92
+ {reply, Reply, NewState};
93
+ handle_call(_Request, _From, State) ->
94
+ Reply = ok,
95
+ {reply, Reply, State}.
96
+ %%--------------------------------------------------------------------
97
+ %% Function: handle_cast(Msg, State) -> {noreply, State} |
98
+ %% {noreply, State, Timeout} |
99
+ %% {stop, Reason, State}
100
+ %% Description: Handling cast messages
101
+ %%--------------------------------------------------------------------
102
+ handle_cast({run_command, Cmd}, State) ->
103
+ {ok, NewState} = run_command(Cmd, State),
104
+ {noreply, NewState};
105
+ handle_cast(_Msg, State) ->
106
+ {noreply, State}.
107
+
108
+ %%--------------------------------------------------------------------
109
+ %% Function: handle_info(Info, State) -> {noreply, State} |
110
+ %% {noreply, State, Timeout} |
111
+ %% {stop, Reason, State}
112
+ %% Description: Handling all non call/cast messages
113
+ %%--------------------------------------------------------------------
114
+ handle_info(_Info, State) ->
115
+ {noreply, State}.
116
+
117
+ %%--------------------------------------------------------------------
118
+ %% Function: terminate(Reason, State) -> void()
119
+ %% Description: This function is called by a gen_server when it is about to
120
+ %% terminate. It should be the opposite of Module:init/1 and do any necessary
121
+ %% cleaning up. When it returns, the gen_server terminates with Reason.
122
+ %% The return value is ignored.
123
+ %%--------------------------------------------------------------------
124
+ terminate(_Reason, _State) ->
125
+ ok.
126
+
127
+ %%--------------------------------------------------------------------
128
+ %% Func: code_change(OldVsn, State, Extra) -> {ok, NewState}
129
+ %% Description: Convert process state when code is changed
130
+ %%--------------------------------------------------------------------
131
+ code_change(_OldVsn, State, _Extra) ->
132
+ {ok, State}.
133
+
134
+ % Quick helper for running commands
135
+ run_command(Cmd) -> gen_server:call(server_location(), {run_command, Cmd}).
136
+ check_command(Cmd) ->
137
+ Command = lists:flatten(io_lib:format("~s", [Cmd])),
138
+ gen_server:call(server_location(), {check_command, Command}).
139
+
140
+ % Run the command, start up the
141
+ run_command(Cmd, State) ->
142
+ Command = lists:flatten(io_lib:format("~s", [Cmd])),
143
+ AtomCommand = erlang:list_to_atom(Command),
144
+ Pid = spawn(fun() -> spawn_command(Command) end),
145
+ Storage = Pid,
146
+ ?TRACE("storing into state", [AtomCommand]),
147
+ NewState = State#state{processes = ?DICT:store(AtomCommand, Storage, State#state.processes)},
148
+ {ok, NewState}.
149
+
150
+ spawn_command(Command) ->
151
+ Port = erlang:open_port({spawn, Command}, [stream, exit_status, stderr_to_stdout, use_stdio]),
152
+ ResponsePid = response_reader(Port),
153
+ spawn_command_loop(Command, Port, ResponsePid).
154
+
155
+ spawn_command_loop(Command, Port, Responses) ->
156
+ receive
157
+ {Pid, collect} ->
158
+ case erlang:is_pid(Responses) of
159
+ true ->
160
+ io:format("There is no output on your command yet, try again in a few seconds ~p~n", [Responses]),
161
+ spawn_command_loop(Command, Port, Responses);
162
+ false ->
163
+ Pid ! {command_response, Responses}
164
+ end;
165
+ {exit_status, _} ->
166
+ spawn_command_loop(Command, Port, Responses);
167
+ {done, Port, Response} ->
168
+ ?TRACE("Received done message", Response),
169
+ spawn_command_loop(Command, Port, Response);
170
+ {Port, {exit_status, 0}} ->
171
+ ?TRACE("Received exit_status", [Port]),
172
+ Responses ! {Port, {exit_status, 0, self()}},
173
+ receive
174
+ {ok, Resp} ->
175
+ ?TRACE("Received ok back", [Resp]),
176
+ spawn_command_loop(Command, Port, Resp)
177
+ end;
178
+ Mes ->
179
+ ?TRACE("received message", [Mes]),
180
+ Responses ! Mes,
181
+ spawn_command_loop(Command, Port, Responses)
182
+ end.
183
+
184
+ response_reader(Port) ->
185
+ ResponsePid = spawn(fun() -> response_reader_loop(Port, []) end),
186
+ ResponsePid.
187
+
188
+ response_reader_loop(Port, Acc) ->
189
+ receive
190
+ {Port, {data, Bin}} ->
191
+ ?TRACE("received data", [Bin]),
192
+ response_reader_loop(Port, [Bin|Acc]);
193
+ {Port, {exit_status, 0, Pid}} ->
194
+ catch erlang:port_close(Port),
195
+ Response = lists:flatten(lists:reverse(Acc)),
196
+ ?TRACE("received exit_status", [Response, Port]),
197
+ Pid ! {ok, Response};
198
+ {Port, {exit_status, _}} ->
199
+ catch erlang:port_close(Port),
200
+ Output = lists:flatten(lists:reverse(Acc)),
201
+ {error, Output};
202
+ {Pid, get_data} ->
203
+ ?TRACE("get_data for", [Pid, Acc]),
204
+ Pid ! {data, Port, Acc},
205
+ response_reader_loop(Port, Acc);
206
+ {_, collect} ->
207
+ response_reader_loop(Port, Acc);
208
+ Mes ->
209
+ io:format("Unexpected message in response_reader_loop ~p~n", [Mes]),
210
+ response_reader_loop(Port, Acc)
211
+ end.
212
+
213
+ server_location() -> global:whereis_name(?SERVER).
@@ -2,57 +2,71 @@ module PoolParty
2
2
  class Base
3
3
  plugin :heartbeat do
4
4
 
5
- # TODO: Reimplement heartbeat
6
5
  def enable
7
- # execute_if("$hostname", "master") do
8
- # has_package(:name => "heartbeat-2", :ensure => "installed") do
9
- # # These can also be passed in via hash
10
- # has_service(:name => "heartbeat", :hasstatus => true)
11
- #
12
- # has_remotefile(:name => "/etc/ha.d/ha.cf") do
13
- # mode 444
14
- # notify service(:name => "heartbeat")
15
- # template File.join(File.dirname(__FILE__), "..", "templates/ha.cf")
16
- # end
17
- #
18
- # has_exec(:name => "heartbeat-update-cib", :command => "/usr/sbin/cibadmin -R -x /etc/ha.d/cib.xml", :refreshonly => true)
19
- #
20
- # has_remotefile(:name => "/etc/ha.d/authkeys") do
21
- # mode 400
22
- # notify service(:name => "heartbeat")
23
- # template File.join(File.dirname(__FILE__), "..", "templates/authkeys")
24
- # end
25
- #
26
- # has_remotefile(:name => "/etc/ha.d/cib.xml") do
27
- # mode 444
28
- # notify exec(:name => "heartbeat-update-cib")
29
- # template File.join(File.dirname(__FILE__), "..", "templates/cib.xml")
30
- # end
31
- # end
32
- #
33
- # if @parent.provisioning?
34
- # variable(:name => "ha_nodenames", :value => "#{list_of_running_instances.map{|a| "#{a.send :name}" }.join("\t")}")
35
- # variable(:name => "ha_node_ips", :value => "#{list_of_running_instances.map{|a| "#{a.send :ip}" }.join("\t")}")
36
- # else
37
- # # variables for the templates
38
- # variable(:name => "ha_nodenames", :value => "generate('/usr/bin/env', '/var/lib/gems/1.8/bin/server-list-active', '-c', 'name')")
39
- # variable(:name => "ha_node_ips", :value => "generate('/usr/bin/env', '/var/lib/gems/1.8/bin/server-list-active', '-c', 'ip')")
40
- # end
41
- #
42
- # has_variable({:name => "ha_timeout", :value => (self.respond_to?(:timeout) ? timeout : "5s")})
43
- # has_variable({:name => "ha_port", :value => (self.respond_to?(:port) ? port : Base.port)})
44
- #
45
- # end
46
- #
47
- # execute_if("$hostname", "master") do
6
+ # execute_on_master do
7
+ has_package(:name => "heartbeat") do
8
+ has_service(:name => "heartbeat", :hasstatus => true, :hasrestart => true)
9
+ has_directory(:name => "/etc/ha.d")
10
+
11
+ has_remotefile(:name => "/etc/ha.d/ha.cf") do
12
+ mode 444
13
+ notify service(:name => "heartbeat")
14
+ template File.join(File.dirname(__FILE__), "..", "templates/ha.cf")
15
+ end
16
+
17
+ has_remotefile(:name => "/etc/ha.d/logd.cf") do
18
+ mode 600
19
+ notify service(:name => "heartbeat")
20
+ template File.join(File.dirname(__FILE__), "..", "templates/logd.cf")
21
+ end
22
+
23
+ has_exec(:name => "heartbeat-update-cib", :command => "/usr/sbin/cibadmin -R -x /etc/ha.d/cib.xml", :refreshonly => true)
24
+
25
+ has_remotefile(:name => "/etc/ha.d/authkeys") do
26
+ mode 600
27
+ notify service(:name => "heartbeat")
28
+ template File.join(File.dirname(__FILE__), "..", "templates/authkeys")
29
+ end
30
+
31
+ has_remotefile(:name => "/etc/ha.d/cib.xml") do
32
+ mode 444
33
+ notify exec(:name => "heartbeat-update-cib")
34
+ template File.join(File.dirname(__FILE__), "..", "templates/cib.xml")
35
+ end
36
+
37
+ has_remotefile(:name => "/etc/ha.d/haresources") do
38
+ mode 644
39
+ template File.join(File.dirname(__FILE__), "..", "templates/haresources")
40
+ end
41
+ # end
42
+
43
+ # variables for the templates
44
+ has_variable(:name => "ha_nodenames", :value => "generate('/usr/bin/env', '/usr/bin/server-list-active', '-c', 'name', '-n', '#{cloud.name}')")
45
+ has_variable(:name => "ha_node_ips", :value => "generate('/usr/bin/env', '/usr/bin/server-list-active', '-c', 'ip', '-n', '#{cloud.name}')")
46
+
47
+ has_variable({:name => "ha_timeout", :value => (self.respond_to?(:timeout) ? timeout : "5s")})
48
+ has_variable({:name => "ha_port", :value => (self.respond_to?(:port) ? port : Base.port)})
49
+
50
+ # Finally, let's set a few options and start it
51
+ # has_exec(:name => "set and start") do
52
+ # refreshonly true
53
+ # command <<-EOC
54
+ # crm_mon -i5
55
+ # EOC
56
+ # end
57
+
58
+ end
59
+
60
+ # execute_on_master do
48
61
  # if list_of_node_names.size > 1
49
62
  # has_exec(:name => "update pem for heartbeat", :refreshonly => true) do
50
- # command "scp /etc/puppet/ssl/ca/ca_crl.pem #{user || Base.user}@#{list_of_node_ips[1]}:/etc/puppet/ssl/ca"
63
+ # command "scp /etc/puppet/ssl/ca/ca_crl.pem #{user || Base.user}@#{list_of_node_ips[1]}:#{Base.base_config_directory}/ssl/ca"
51
64
  # end
52
65
  # end
53
66
  # end
54
67
 
55
68
  end
69
+
56
70
  end
57
71
  end
58
72
  end
@@ -49,12 +49,12 @@ module PoolParty
49
49
  template File.join(File.dirname(__FILE__), "..", "templates/puppetrunner")
50
50
  end
51
51
 
52
- execute_on_node do
53
- has_cron(:name => "node puppetd runner", :user => Base.user, :minute => "*/5") do
52
+ # execute_on_node do
53
+ has_cron(:name => "node puppetd runner", :user => Base.user, :minute => "*/15") do
54
54
  requires get_gempackage("poolparty")
55
55
  command "/usr/bin/puppetrunner"
56
56
  end
57
- end
57
+ # end
58
58
 
59
59
  # end
60
60
 
@@ -68,13 +68,23 @@ module PoolParty
68
68
 
69
69
  # Custom run puppet to minimize footprint
70
70
  # TODO: Update the offsetted times
71
+ has_remotefile(:name => "/usr/bin/puppetrerun") do
72
+ mode 744
73
+ template File.join(File.dirname(__FILE__), "..", "templates/puppetrerun")
74
+ end
75
+
76
+ has_remotefile(:name => "/usr/bin/puppetcleaner") do
77
+ mode 744
78
+ template File.join(File.dirname(__FILE__), "..", "templates/puppetcleaner")
79
+ end
80
+
71
81
  execute_on_master do
72
82
  has_exec(:name => "update_hosts", :command => ". /etc/profile && server-update-hosts -n #{cloud.name}")
73
83
 
74
- has_cron(:name => "master puppetd runner", :user => Base.user, :minute => "*/15") do
75
- requires get_gempackage("poolparty")
76
- command(PoolParty::Remote::RemoteInstance.puppet_runner_command)
77
- end
84
+ # has_cron(:name => "master puppetd runner", :user => Base.user, :minute => "*/15") do
85
+ # requires get_gempackage("poolparty")
86
+ # command(PoolParty::Remote::RemoteInstance.puppet_runner_command)
87
+ # end
78
88
  has_cron(:name => "Load handler", :user => Base.user, :minute => "*/4") do
79
89
  requires get_gempackage("poolparty")
80
90
  command(". /etc/profile && cloud-handle-load -n #{cloud.name}")
@@ -93,15 +103,8 @@ module PoolParty
93
103
 
94
104
  has_cron({:name => "maintain script", :command => ". /etc/profile && cloud-maintain -n #{cloud.name}", :minute => "*/3", :requires => [get_gempackage("poolparty"), get_cron("puppetd runner"), get_cron("Load handler"), get_service("haproxy")]})
95
105
 
96
- has_remotefile(:name => "/usr/bin/puppetcleaner") do
97
- mode 744
98
- template File.join(File.dirname(__FILE__), "..", "templates/puppetcleaner")
99
- end
106
+ has_cron(:name => "ensure puppetmaster is running", :command => ". /etc/profile && puppetmasterd --verbose", :hour => "0")
100
107
 
101
- has_remotefile(:name => "/usr/bin/puppetrerun") do
102
- mode 744
103
- template File.join(File.dirname(__FILE__), "..", "templates/puppetrerun")
104
- end
105
108
  end
106
109
  # has_host(:name => "puppet", :ip => (self.respond_to?(:master) ? self : parent).master.ip)
107
110
  end
@@ -0,0 +1,18 @@
1
+ module PoolParty
2
+ module Capistrano
3
+
4
+ def set_cloud(cld=nil)
5
+ raise unless cld
6
+ @cloud = cld
7
+ end
8
+
9
+ def set_poolparty_roles
10
+ returning Array.new do |arr|
11
+ arr << "role 'master.#{@cloud.name}'.to_sym, '#{@cloud.master.ip}'"
12
+ arr << "role :master, '#{@cloud.master.ip}'"
13
+ arr << "role :slaves, '#{@cloud.nonmaster_nonterminated_instances.map{|a| a.ip}.join('", "')}'" if @cloud.nonmaster_nonterminated_instances.size > 0
14
+ end.join("\n")
15
+ end
16
+
17
+ end
18
+ end
@@ -1,2 +1,26 @@
1
+ # Taken from rspec with high respect.
2
+ # Mainly unused, for now
1
3
  class Class
4
+ # Creates a new subclass of self, with a name "under" our own name.
5
+ # Example:
6
+ #
7
+ # x = Foo::Bar.subclass('Zap'){}
8
+ # x.name # => Foo::Bar::Zap_1
9
+ # x.superclass.name # => Foo::Bar
10
+ def subclass(base_name, &body)
11
+ klass = Class.new(self)
12
+ class_name = "#{base_name}_#{class_count!}"
13
+ instance_eval do
14
+ const_set(class_name, klass)
15
+ end
16
+ klass.instance_eval(&body)
17
+ klass
18
+ end
19
+
20
+ private
21
+ def class_count!
22
+ @class_count ||= 0
23
+ @class_count += 1
24
+ @class_count
25
+ end
2
26
  end
@@ -24,14 +24,21 @@ module Kernel
24
24
  ensure
25
25
  $-v = saved_verbosity
26
26
  end
27
+
28
+ #redirect stdout and stderr to /dev/null and reopen after block
27
29
  def hide_output
28
30
  begin
29
31
  old_stdout = STDOUT.dup
32
+ old_stderr = STDERR.dup
30
33
  STDOUT.reopen(File.open((PLATFORM =~ /mswin/ ? "NUL" : "/dev/null"), 'w'))
34
+ STDERR.reopen(File.open((PLATFORM =~ /mswin/ ? "NUL" : "/dev/null"), 'w'))
31
35
  yield if block_given?
32
36
  ensure
33
37
  STDOUT.flush
34
38
  STDOUT.reopen(old_stdout)
39
+ STDERR.flush
40
+ STDERR.reopen(old_stderr)
35
41
  end
36
42
  end
43
+
37
44
  end
@@ -34,7 +34,7 @@ class Module
34
34
  end
35
35
  nil
36
36
  end
37
- def set(*args)
37
+ def instance_variables_from_hash(h={})
38
+ h.each {|k,v| instance_eval "@#{k} = #{v}"}
38
39
  end
39
- alias_method :custom, :set
40
40
  end