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
@@ -2,14 +2,17 @@
2
2
  This module is included by the remote module and defines the remoting methods
3
3
  that the clouds can use to rsync or run remote commands
4
4
  =end
5
- require File.dirname(__FILE__) + "/../helpers/provisioner_base"
6
-
7
5
  module PoolParty
8
6
  module Remote
9
7
  module Remoter
10
- def rsync_storage_files_to_command(remote_instance)
8
+ def rsync_storage_files_to_command(remote_instance)
9
+ #TODO: rsync_to_command("#{Base.storage_directory}/", Base.remote_storage_path, remote_storage_path) if remote_instance
11
10
  "#{rsync_command} #{Base.storage_directory}/ #{remote_instance.ip}:#{Base.remote_storage_path}" if remote_instance
12
11
  end
12
+ # rsync a file to a node. By default to the master node.
13
+ def rsync_to_command(source, target=source, remote_instance=master)
14
+ "#{rsync_command} #{source} #{remote_instance.ip}:#{target}"
15
+ end
13
16
  def run_command_on_command(cmd="ls -l", remote_instance=nil)
14
17
  vputs "Running #{cmd} on #{remote_instance.name == %x[hostname].chomp ? "self (master)" : "#{remote_instance.name}"}"
15
18
  remote_instance.name == %x[hostname].chomp ? %x[#{cmd}] : "#{ssh_command(remote_instance)} '#{cmd}'"
@@ -25,11 +28,12 @@ module PoolParty
25
28
  # Includes StrictHostKeyChecking to no
26
29
  # Ssh with the user in Base
27
30
  # And including the keypair_path
31
+ # "-l '#{Base.user}'",
28
32
  def ssh_array
29
- ["-o StrictHostKeyChecking=no", "-l '#{Base.user}'", '-i "'+full_keypair_path+'"']
33
+ ["-o StrictHostKeyChecking=no", "-l #{Base.user}", '-i "'+full_keypair_path+'"']
30
34
  end
31
35
  def rsync_command
32
- "rsync -azP --exclude cache -e '#{ssh_string}'"
36
+ "rsync -azP --exclude cache -e '#{ssh_string} -l #{Base.user}'"
33
37
  end
34
38
  def remote_ssh_array
35
39
  ["-o StrictHostKeyChecking=no", "-l '#{Base.user}'", '-i "'+remote_keypair_path+'"']
@@ -40,6 +44,13 @@ module PoolParty
40
44
  def remote_rsync_command
41
45
  "rsync -azP --exclude cache -e '#{remote_ssh_string}'"
42
46
  end
47
+
48
+
49
+ # def scp_command(source, dest=target, remote_instance=master)
50
+ # #TODO: check if source is Directory and add -r if it is
51
+ # "scp #{source} #{remote_instance.ip}:#{dest} #{ssh_array.join(' ')}"
52
+ # end
53
+
43
54
  # Get the names of the nodes. Mainly used for puppet templating
44
55
  def list_of_node_names(options={})
45
56
  list_of_running_instances.collect {|ri| ri.name }
@@ -71,10 +82,22 @@ module PoolParty
71
82
  def minimum_number_of_instances_are_running?
72
83
  list_of_running_instances.size >= minimum_instances.to_i
73
84
  end
85
+ # Are the minimum number of instances NOT running?
86
+ def minimum_number_of_instances_are_not_running?
87
+ !(minimum_number_of_instances_are_running?)
88
+ end
74
89
  # Can we shutdown an instance?
75
90
  def can_shutdown_an_instance?
76
91
  list_of_running_instances.size > minimum_instances.to_i
77
92
  end
93
+ # Are too few instances running?
94
+ def are_too_few_instances_running?
95
+ list_of_running_instances.size < minimum_instances.to_i
96
+ end
97
+ # Are there more instances than allowed?
98
+ def are_too_many_instances_running?
99
+ list_of_running_instances.size > maximum_instances.to_i
100
+ end
78
101
  # Request to launch a number of instances
79
102
  def request_launch_new_instances(num=1)
80
103
  out = []
@@ -82,11 +105,15 @@ module PoolParty
82
105
  out
83
106
  end
84
107
  def request_launch_master_instance
85
- inst = launch_new_instance!
108
+ @inst = launch_new_instance!
86
109
  wait "5.seconds"
87
- when_no_pending_instances {after_launch_master(inst)}
110
+ when_no_pending_instances do
111
+ vputs "Master has launched"
112
+ reset!
113
+ after_launch_master(@inst)
114
+ end
88
115
  end
89
- def after_launch_master(h={})
116
+ def after_launch_master(inst=nil)
90
117
  vputs "After launch master in remoter"
91
118
  end
92
119
  # Let's terminate an instance that is not the master instance
@@ -161,13 +188,14 @@ module PoolParty
161
188
  last_instances = nonmaster_nonterminated_instances[(@num_instances - (num))..(@num_instances)]
162
189
  last_instances.each do |inst|
163
190
  vputs "Provision slave: #{inst}"
164
- hide_output {PoolParty::Provisioner.process_clean_reconfigure_for!(inst, self)}
165
- PoolParty::Provisioner.provision_slave(inst, self, false) unless inst.master? rescue vputs "Error"
166
- hide_output {PoolParty::Provisioner.process_clean_reconfigure_for!(inst, self)}
191
+ # hide_output {PoolParty::Provisioner.process_clean_reconfigure_for!(inst, self)}
192
+ # PoolParty::Provisioner.provision_slave(inst, self, false) unless inst.master? rescue vputs "Error"
193
+ verbose ? provisioner_for(inst).install(testing) : hide_output { provisioner_for(inst).install(testing) }
194
+ # hide_output {PoolParty::Provisioner.process_clean_reconfigure_for!(inst, self)}
167
195
  # cmd = ". /etc/profile && cloud-provision -i #{inst.name.gsub(/node/, '')} &"
168
196
  # vputs "Provision slave with command #{cmd}"
169
197
  end
170
- PoolParty::Provisioner.reconfigure_master(self)
198
+ # PoolParty::Provisioner.reconfigure_master(self)
171
199
  end
172
200
  end
173
201
  # Launch the master and let the master handle the starting of the cloud
@@ -177,7 +205,7 @@ module PoolParty
177
205
  # Then wait for the master to launch
178
206
  def launch_and_configure_master!(testing=false)
179
207
  vputs "Requesting to launch new instance"
180
- logger.debug "Launching master"
208
+ log.debug "Launching master"
181
209
  request_launch_master_instance if list_of_pending_instances.size.zero? && can_start_a_new_instance? && !is_master_running? && !testing
182
210
  reset!
183
211
  unless testing
@@ -188,23 +216,36 @@ module PoolParty
188
216
  vputs ""
189
217
  vputs "Provisioning master..."
190
218
  # cleanup_storage_directory
191
- verbose ? Provisioner.provision_master(self, testing) : hide_output { Provisioner.provision_master(self, testing) }
192
- verbose ? Provisioner.clear_master_ssl_certs(self, testing) : hide_output { Provisioner.clear_master_ssl_certs(self, testing) }
219
+ @provisioner = PoolParty::Provisioner::Capistrano.new(master, self, :ubuntu)
220
+ verbose ? @provisioner.install(testing) : hide_output { @provisioner.install(testing) }
193
221
 
194
222
  after_launched
195
223
  end
196
224
  end
197
225
  end
226
+ def list_of_nodes_exceeding_minimum_runtime
227
+ list_of_running_instances.reject{|i| i.elapsed_runtime < minimum_runtime}
228
+ end
229
+ def are_any_nodes_exceeding_minimum_runtime?
230
+ !list_of_nodes_exceeding_minimum_runtime.blank?
231
+ end
198
232
  def is_master_running?
199
233
  !list_of_running_instances.select {|a| a.name == "master"}.first.nil?
200
234
  end
201
235
  # Stub method for the time being to handle expansion of the cloud
202
236
  def should_expand_cloud?(force=false)
203
- valid_rules?(:expand_when) || force || false
237
+ (are_too_few_instances_running? || are_expansion_rules_valid? ) || force || false
238
+ end
239
+ def are_expansion_rules_valid?
240
+ valid_rules?(:expand_when)
204
241
  end
205
242
  # Stub method for the time being to handle the contraction of the cloud
206
243
  def should_contract_cloud?(force=false)
207
- valid_rules?(:contract_when) || force || false
244
+ return true if force
245
+ ((are_any_nodes_exceeding_minimum_runtime? and are_too_many_instances_running?) || are_contraction_rules_valid?) || false
246
+ end
247
+ def are_contraction_rules_valid?
248
+ valid_rules?(:contract_when)
208
249
  end
209
250
  # Expand the cloud
210
251
  # If we can start a new instance and the load requires us to expand
@@ -229,12 +270,10 @@ module PoolParty
229
270
  # If we can shutdown an instnace and the load allows us to contract
230
271
  # the cloud, then we should request_termination_of_non_master_instance
231
272
  def contract_cloud_if_necessary(force=false)
232
- if can_shutdown_an_instance?
233
- if should_contract_cloud?(force)
234
- vputs "Shrinking the cloud by 1"
235
- before_shutdown
236
- request_termination_of_non_master_instance
237
- end
273
+ if can_shutdown_an_instance? && should_contract_cloud?(force)
274
+ vputs "Shrinking the cloud by 1"
275
+ before_shutdown
276
+ request_termination_of_non_master_instance
238
277
  end
239
278
  end
240
279
 
@@ -250,6 +289,13 @@ module PoolParty
250
289
  def before_shutdown
251
290
  end
252
291
 
292
+ # Rsync a file or directory to a node. Rsync to master by default
293
+ def rsync_to(source, target=source, num=0)
294
+ str = "#{rsync_to_command(source, target, get_instance_by_number( num ))}"
295
+ vputs "Running: #{str}"
296
+ verbose ? Kernel.system(str) : hide_output {Kernel.system str}
297
+ end
298
+
253
299
  # Rsync command to the instance
254
300
  def rsync_storage_files_to(instance=nil)
255
301
  hide_output {Kernel.system "#{rsync_storage_files_to_command(instance)}" if instance}
@@ -262,7 +308,9 @@ module PoolParty
262
308
 
263
309
  # Ssh into the instance given
264
310
  def ssh_into(instance=nil)
265
- Kernel.system "#{ssh_command(instance)}" if instance
311
+ cmd = "#{ssh_command(instance)}"
312
+ vputs "Running #{cmd}"
313
+ Kernel.system cmd if instance
266
314
  end
267
315
  # Find the instance by the number given
268
316
  # and then ssh into the instance
@@ -88,6 +88,9 @@ module PoolParty
88
88
  name = (i.zero? ? "master" : "node#{i}")
89
89
  list.select {|i| i.name == name }.first
90
90
  end
91
+ # A callback before the configuration task takes place
92
+ def before_configuration_tasks
93
+ end
91
94
  def remote_instances_list
92
95
  @containing_cloud = self
93
96
  # puts "> #{@containing_cloud} #{@describe_instances.nil?}"
@@ -137,6 +140,13 @@ module PoolParty
137
140
  # Callback after loaded
138
141
  def loaded_remoter_base
139
142
  end
143
+
144
+ # Custom minimum runnable options
145
+ # Extend the minimum runnable options that are necessary
146
+ # for poolparty to run on the remote base
147
+ def custom_minimum_runnable_options
148
+ []
149
+ end
140
150
 
141
151
  # Custom installation tasks
142
152
  # Allow the remoter bases to attach their own tasks on the
@@ -18,17 +18,18 @@ module PoolParty
18
18
 
19
19
  def package_directory
20
20
  path = ::File.join( Base.tmp_path, "#{::File.basename(from_dir)}.tar.gz" )
21
- archive_name = "#{name.dir_safe}.tar.gz"
21
+ archive_name = "#{::File.basename(name).dir_safe}.tar.gz"
22
22
  cmd = "cd #{::File.expand_path(from_dir)} && tar -czf #{archive_name} . && mv #{archive_name} #{Base.tmp_path}"
23
- `#{cmd}` unless testing
23
+ Kernel.system(cmd) unless testing
24
24
  end
25
25
 
26
26
  def unpack_directory
27
27
  execute_on_master do
28
28
  has_exec({:name => "deploy-directory-#{name}", :requires => get_directory("#{cwd}"), :cwd => cwd}) do
29
29
  # && rm #{Base.tmp_path}/#{parent.name.dir_safe}.tar.gz
30
- command "cd #{cwd}; tar -zxf #{Base.remote_storage_path}/#{name.dir_safe}.tar.gz; rm #{Base.remote_storage_path}/#{name.dir_safe}.tar.gz"
31
- onlyif "test -f #{Base.remote_storage_path}/#{name.dir_safe}.tar.gz"
30
+ archive_name = "#{::File.basename(name).dir_safe}.tar.gz"
31
+ command "cd #{cwd}; tar -zxf #{Base.remote_storage_path}/#{archive_name}; rm #{Base.remote_storage_path}/#{archive_name}; chown #{owner} #{::File.basename(name).dir_safe}"
32
+ onlyif "test -f #{Base.remote_storage_path}/#{archive_name}"
32
33
  end
33
34
  end
34
35
  end
@@ -45,7 +46,11 @@ module PoolParty
45
46
 
46
47
  def to(dir)
47
48
  cwd dir
48
- has_directory(:name => "#{dir}", :requires => get_directory("#{::File.dirname(dir)}"))
49
+ name dir
50
+ has_directory(:name => "#{dir}",
51
+ :requires => get_directory("#{::File.dirname(dir)}"),
52
+ :owner => owner,
53
+ :mode => mode)
49
54
  end
50
55
 
51
56
  # Since git is not a native type, we have to say which core resource
@@ -0,0 +1,51 @@
1
+ module PoolParty
2
+ class GitResource
3
+
4
+ virtual_resource(:git) do
5
+
6
+ def loaded(opts={}, parent=self)
7
+ has_git_repos
8
+ end
9
+
10
+ def has_git_repos
11
+ has_package(:name => "git-core")
12
+ has_exec({:name => key, :requires => [get_directory("#{working_dir}"), get_package("git-core")] }) do
13
+ command requires_user ? "git clone #{requires_user}@#{source} #{working_dir}" : "cd #{working_dir} && git clone #{source}"
14
+ cwd "#{working_dir if working_dir}"
15
+ creates creates_dir
16
+ end
17
+ has_exec(:name => "update-#{name}") do
18
+ cwd ::File.dirname( creates_dir )
19
+ command "git pull"
20
+ end
21
+ end
22
+
23
+ def at(dir)
24
+ working_dir dir
25
+ has_directory(:name => "#{dir}", :requires => get_directory("#{::File.dirname(dir)}"))
26
+ end
27
+
28
+ def to(dir)
29
+ at(dir)
30
+ end
31
+
32
+ def creates_dir
33
+ "#{::File.join( working_dir, ::File.basename(source, ::File.extname(source)) )}/.git"
34
+ end
35
+
36
+ # Since git is not a native type, we have to say which core resource
37
+ # it is using to be able to require it
38
+ def class_type_name
39
+ "exec"
40
+ end
41
+
42
+ # Because we are requiring an exec, instead of a built-in package of the git, we have to overload
43
+ # the to_s method and prepend it with the same name as above
44
+ def key
45
+ "git-#{name}"
46
+ end
47
+
48
+ end
49
+
50
+ end
51
+ end
@@ -20,15 +20,17 @@ module PoolParty
20
20
  :template_directory => "templates",
21
21
  :template_path => "/var/lib/puppet/templates",
22
22
  :module_path => "/etc/puppet/modules/poolparty",
23
- :default_specfile_name => "pool.spec",
24
- :default_project_specfile_name => "spec/pool.spec",
23
+ :default_specfile_name => "clouds.pool",
24
+ :default_project_specfile_name => "spec/clouds.pool",
25
25
  :port => "80",
26
26
  :forwarding_port => "8080",
27
27
  :proxy_mode => "http",
28
28
  :messenger_client_port => 7050,
29
+ :minimum_runtime => 3000, #50.minutes in seconds
29
30
  # EC2 Options
30
31
  :ami => "ami-1cd73375",
31
32
  :size => 'm1.small', # must be 'm1.small', 'm1.large', 'm1.xlarge', 'c1.medium', or 'c1.xlarge'
33
+ :availabilty_zone => "us-east-1a",
32
34
  :security_group => ["default"],
33
35
  # Options that should not be touched pretty much ever
34
36
  :manifest_path => "/etc/puppet/manifests"
@@ -24,6 +24,7 @@ module PoolParty
24
24
  include PrettyPrinter
25
25
  include Configurable
26
26
  include CloudResourcer
27
+ include Provisioner
27
28
  # extend CloudResourcer
28
29
  # Net methods
29
30
  include Remote
@@ -38,6 +39,8 @@ module PoolParty
38
39
  :secret_access_key => Base.secret_access_key,
39
40
  :ec2_dir => ENV["EC2_HOME"],
40
41
  :keypair => (ENV["KEYPAIR_NAME"].nil? || ENV["KEYPAIR_NAME"].empty?) ? nil : ENV["KEYPAIR_NAME"],
42
+ :minimum_runtime => Base.minimum_runtime,
43
+ :user => Base.user,
41
44
  :ami => 'ami-44bd592d'
42
45
  })
43
46
 
@@ -45,15 +48,18 @@ module PoolParty
45
48
  @cloud_name = name
46
49
  @cloud_name.freeze
47
50
 
48
- plugin_directory "#{::Dir.pwd}/plugins"
51
+ plugin_directory
49
52
 
50
53
  p = pare.is_a?(PoolParty::Pool::Pool) ? pare : nil
51
- run_setup(p, &block)
54
+ store_block(&block)
55
+ run_setup(p, &block)
52
56
 
53
57
  # set_parent(parent) if parent && !@parent
54
58
  # self.run_in_context parent, &block if block
55
59
  setup_defaults
56
- reset_remoter_base!
60
+ # realize_plugins!
61
+ # reset! # reset the clouds
62
+ # reset_remoter_base!
57
63
  end
58
64
 
59
65
  def setup_defaults
@@ -76,7 +82,7 @@ module PoolParty
76
82
  def generate_keypair(*args)
77
83
  options[:keypair] = "#{parent && parent.is_a?(PoolParty::Pool::Pool) ? parent.name : "poolparty"}_#{name}" unless has_keypair?
78
84
  end
79
-
85
+
80
86
  # Prepare to send the new configuration to the instances
81
87
  # First, let's make sure that our base directory is made
82
88
  # Then copy the templates that have no other reference in
@@ -94,6 +100,8 @@ module PoolParty
94
100
  Script.save!(self)
95
101
  # not my favorite...
96
102
  copy_ssh_key
103
+ write_unique_cookie
104
+ before_configuration_tasks
97
105
  end
98
106
 
99
107
  # Copy the ssh keys to the storage directory in preparation for
@@ -108,6 +116,20 @@ module PoolParty
108
116
  Base.store_keys_in_file_for(self)
109
117
  end
110
118
 
119
+ # Let's write the cookie into the tmp path
120
+ def write_unique_cookie
121
+ write_to_file_in_storage_directory("cookie") do
122
+ generate_unique_cookie_string
123
+ end
124
+ end
125
+
126
+ # Generate a unique cookie string so that our erlang modules can
127
+ # talk to each other safely. This is based off the keypair
128
+ # and the name of the cloud
129
+ def generate_unique_cookie_string
130
+ Digest::SHA256.hexdigest("#{full_keypair_name}#{name}")
131
+ end
132
+
111
133
  # Build the new poolparty manifest
112
134
  # Wrapping all of these requirements into the one
113
135
  # poolparty class.
@@ -125,7 +147,7 @@ module PoolParty
125
147
  end
126
148
 
127
149
  def copy_misc_templates
128
- ["namespaceauth.conf"].each do |f|
150
+ ["namespaceauth.conf", "puppet.conf", "gem"].each do |f|
129
151
  copy_file_to_storage_directory(::File.join(::File.dirname(__FILE__), "..", "templates", f))
130
152
  end
131
153
  end
@@ -197,10 +219,10 @@ module PoolParty
197
219
  # they need a few options to run, these are the required options
198
220
  # to be saved on the remote "master" machine
199
221
  def minimum_runnable_options
200
- [
201
- :keypair, :minimum_instances, :maximum_instances, :ami, :security_group,
222
+ ([
223
+ :keypair, :minimum_instances, :maximum_instances,
202
224
  :expand_when, :contract_when, :set_master_ip_to
203
- ]
225
+ ]<< custom_minimum_runnable_options).flatten
204
226
  end
205
227
 
206
228
  # Add all the poolparty requirements here
@@ -209,12 +231,12 @@ module PoolParty
209
231
  # Also note that there is no block associated. This is because we have written
210
232
  # all that is necessary in a method called enable
211
233
  # which is called when there is no block
212
- def add_poolparty_base_requirements
234
+ def add_poolparty_base_requirements
213
235
  heartbeat
214
236
  haproxy
215
237
  ruby
216
238
  poolparty_base_packages
217
- realize_plugins!
239
+ realize_plugins!(true) # Force realizing of the plugins
218
240
  end
219
241
 
220
242
  def other_clouds
@@ -4,7 +4,7 @@ module PoolParty
4
4
  module PluginModel
5
5
 
6
6
  def plugin(name=:plugin, cloud=nil, &block)
7
- plugins.has_key?(name) ? plugins[name] : (plugins[name] = PluginModel.new(name, cloud, &block))
7
+ plugins.has_key?(name) ? plugins[name] : (plugins[name] = PluginModel.new(name, &block))
8
8
  end
9
9
  alias_method :register_plugin, :plugin
10
10
 
@@ -18,15 +18,15 @@ module PoolParty
18
18
  include Configurable
19
19
  include PrettyPrinter
20
20
 
21
- def initialize(name,cld,&block)
21
+ def initialize(name,&block)
22
22
  @name = name
23
23
  # @parent = cld
24
24
  class_string_name = "#{name}"
25
25
 
26
26
  # Create the class to evaluate the plugin on the implemented call
27
- klass = class_string_name.class_constant(PoolParty::Plugin::Plugin)
27
+ @klass = klass = class_string_name.class_constant(PoolParty::Plugin::Plugin)
28
28
  mod = class_string_name.module_constant(&block)
29
-
29
+
30
30
  klass.send :include, mod
31
31
 
32
32
  # Store the name of the class for pretty printing later
@@ -35,11 +35,10 @@ module PoolParty
35
35
 
36
36
  def initialize(name,&block)
37
37
  setup_defaults
38
-
39
38
  @pool_name = name
40
39
  @pool_name.freeze
41
40
  # run_in_context &block if block
42
- run_setup(self, &block)
41
+ run_setup(self, &block)
43
42
  end
44
43
 
45
44
  def name
@@ -48,6 +47,7 @@ module PoolParty
48
47
 
49
48
  def setup_defaults
50
49
  plugin_directory "#{::File.dirname(pool_specfile ? pool_specfile : Dir.pwd)}/plugins"
50
+ PoolParty::Extra::Deployments.include_deployments "#{Dir.pwd}/deployments"
51
51
  end
52
52
 
53
53
  # This is where the entire process starts
@@ -18,8 +18,9 @@ module PoolParty
18
18
  end
19
19
 
20
20
  def add_resource(type, opts={}, parent=self, &block)
21
- if in_a_resource_store?(type, opts[:name])
22
- @res = get_resource(type, opts[:name], parent)
21
+ if opts[:name] && in_a_resource_store?(type, opts[:name])
22
+ @res = get_from_local_resource_store(type, opts[:name], parent)
23
+ @res ||= get_from_global_resource_store(type, opts[:name])
23
24
  # if should_duplicate_resource?(type, @res, parent, opts)
24
25
  # unless @res.parent == parent
25
26
  # @pa = parent
@@ -85,13 +86,16 @@ module PoolParty
85
86
 
86
87
  include CloudResourcer
87
88
  include Configurable
89
+ # For the time being, we'll make puppet the only available dependency resolution
90
+ # base, but in the future, we can rip this out and make it an option
91
+ include PoolParty::DependencyResolutions::Puppet
88
92
 
89
93
  extend PoolParty::Resources
90
94
  include PoolParty::Resources
91
95
 
92
96
  def self.inherited(subclass)
93
97
  subclass = subclass.to_s.split("::")[-1] if subclass.to_s.index("::")
94
- lowercase_class_name = subclass.to_s.underscore
98
+ lowercase_class_name = subclass.to_s.underscore.downcase || subclass.downcase
95
99
 
96
100
  # Add add resource method to the Resources module
97
101
  unless PoolParty::Resources.respond_to?(lowercase_class_name.to_sym)
@@ -99,8 +103,14 @@ module PoolParty
99
103
  def #{lowercase_class_name}(opts={}, parent=self, &blk)
100
104
  add_resource(:#{lowercase_class_name}, opts, parent, &blk)
101
105
  end
102
- def get_#{lowercase_class_name}(name)
103
- get_resource(:#{lowercase_class_name}, name) if in_a_resource_store?(:#{lowercase_class_name}, name)
106
+ def get_#{lowercase_class_name}(n, opts={}, parent=self, &block)
107
+ res = in_a_resource_store?(:#{lowercase_class_name}, n) ?
108
+ get_resource(:#{lowercase_class_name}, n) :
109
+ nil
110
+ # PoolParty::Resources::Resource.resource_string_name(#{lowercase_class_name}, n)
111
+ # add_resource(:#{lowercase_class_name}, opts, parent, &blk)
112
+ # res ||= PoolParty::Resources::Resource.resource_string_name(#{lowercase_class_name}, n)
113
+ res
104
114
  end
105
115
  EOE
106
116
  PoolParty::Resources.module_eval method
@@ -185,7 +195,7 @@ module PoolParty
185
195
  end
186
196
  # This way we can subclass resources without worry
187
197
  def class_type_name
188
- self.class.to_s.top_level_class.underscore
198
+ self.class.to_s.top_level_class.underscore.downcase
189
199
  end
190
200
  def self.custom_function(str)
191
201
  custom_functions << str
@@ -215,7 +225,7 @@ module PoolParty
215
225
  :subscribe, :owner, :group, :path, :mode, :source, :notify, :subscribe, :check, :creates, :cwd, :command, :ensure,
216
226
  :require, :schedule, :range, :alias, :hour, :minute, :user, :month, :monthday, :name, :onlyif, :unless, :refreshonly,
217
227
  :refresh, :content, :template, :ip, :repeat, :provider, :key, :device, :fstype, :remounts, :options, :atboot, :before,
218
- :binary, :status, :start, :stop, :restart, :pattern, :recurse
228
+ :binary, :status, :start, :stop, :restart, :pattern, :recurse, :home
219
229
  ]
220
230
  end
221
231
  def key
@@ -239,21 +249,20 @@ module PoolParty
239
249
  def get_modified_options
240
250
  unless @modified_options
241
251
  if options
242
- opts = options.inject({}) do |sum,h|
252
+ opts = options.inject({}) do |sum,h|
243
253
  sum.merge!({h[0].to_sym => ((h[1].nil?) ? self.send(h[0].to_sym) : h[1]) })
244
254
  end
245
255
  else
246
256
  opts = {}
247
257
  end
248
258
  @full_allowed_options ||= allowed_options.reject {|ele| disallowed_options.include?(ele) }
249
- @modified_options = opts.reject {|k,v| !@full_allowed_options.include?(k) }
259
+ @modified_options = opts.reject do |k,v|
260
+ !@full_allowed_options.include?(k) ||
261
+ @parent && @parent.respond_to?(:options) && @parent != self && @parent.options.has_key?(k) && @parent.options[k] == options[k]
262
+ end
250
263
  end
251
264
  @modified_options
252
265
  end
253
-
254
- # For the time being, we'll make puppet the only available dependency resolution
255
- # base, but in the future, we can rip this out and make it an option
256
- include PoolParty::DependencyResolutions::Puppet
257
266
  end
258
267
 
259
268
  # Adds two methods to the module
@@ -269,13 +278,22 @@ module PoolParty
269
278
  def self.add_has_and_does_not_have_methods_for(type=:file)
270
279
  module_eval <<-EOE
271
280
  def has_#{type}(opts={}, parent=self, &block)
272
- #{type}(#{type == :exec ? "opts" : "{:is_present => ''}.merge(opts)"}, parent, &block)
281
+ #{type}(handle_option_values(opts).merge(:ensures => "present"), parent, &block)
273
282
  end
274
283
  def does_not_have_#{type}(opts={}, parent=self, &block)
275
- #{type}(#{type == :exec ? "opts" : "{:is_absent => ''}.merge(opts)"}, parent, &block)
284
+ #{type}(handle_option_values(opts).merge(:ensures => "absent"), parent, &block)
276
285
  end
277
286
  EOE
278
287
  end
279
288
 
289
+ def handle_option_values(o)
290
+ case o.class.to_s
291
+ when "String"
292
+ {:name => o}
293
+ else
294
+ o
295
+ end
296
+ end
297
+
280
298
  end
281
299
  end
@@ -22,7 +22,7 @@ module PoolParty
22
22
 
23
23
  # Wrap all the resources into a class package from
24
24
  def classpackage_with_self(parent=self, &block)
25
- name = (parent.options.name || Classpackage.name(parent).to_s).sanitize
25
+ name = (parent && parent.options.name || Classpackage.name(parent).to_s).sanitize
26
26
  if in_global_classpackages?(name)
27
27
  returning get_from_global_classpackage_store(name) do |cls|
28
28
  cls.run_in_context(parent, &block) if block
@@ -45,7 +45,7 @@ module PoolParty
45
45
  store_into_global_classpackage_store(@@cp)
46
46
  end
47
47
  return @@cp
48
- @@parent_resources = nil
48
+ @@parent_resources = @@cp = nil
49
49
  end
50
50
 
51
51
  class Classpackage < Resource
@@ -95,7 +95,7 @@ module PoolParty
95
95
  false
96
96
  end
97
97
 
98
- def self.name(parent=nil)
98
+ def self.name(parent=self)
99
99
  "custom_#{parent ? parent.object_id.to_s : "parent"}"
100
100
  end
101
101
 
@@ -4,15 +4,18 @@ module PoolParty
4
4
  class Directory < Resource
5
5
 
6
6
  default_options({
7
- :ensure => "directory",
8
- :mode => 644,
9
- :owner => "#{Base.user}"
7
+ :mode => 644
8
+ # :owner => "#{Base.user}"
10
9
  })
11
10
 
12
11
  def class_type_name
13
12
  "file"
14
13
  end
15
14
 
15
+ def ensure
16
+ "directory"
17
+ end
18
+
16
19
  def present
17
20
  'directory'
18
21
  end