poolparty 0.2.18 → 0.2.69
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.
- data/Manifest.txt +142 -47
- data/PostInstall.txt +5 -5
- data/README.txt +25 -4
- data/Rakefile +46 -2
- data/bin/cloud +12 -21
- data/bin/cloud-add-keypair +18 -13
- data/bin/cloud-configure +11 -18
- data/bin/cloud-contract +7 -17
- data/bin/cloud-ensure-provisioning +39 -0
- data/bin/cloud-expand +9 -17
- data/bin/cloud-handle-load +27 -0
- data/bin/cloud-list +3 -9
- data/bin/cloud-maintain +12 -18
- data/bin/cloud-osxcopy +3 -9
- data/bin/cloud-provision +20 -21
- data/bin/cloud-refresh +4 -13
- data/bin/cloud-run +3 -4
- data/bin/cloud-ssh +3 -2
- data/bin/cloud-start +18 -21
- data/bin/cloud-stats +17 -0
- data/bin/cloud-terminate +4 -7
- data/bin/messenger-get-current-nodes +14 -0
- data/bin/pool +12 -12
- data/bin/pool-describe +0 -1
- data/bin/{pool-spec → pool-generate} +1 -0
- data/bin/pool-init +28 -0
- data/bin/pool-list +14 -12
- data/bin/pool-start +11 -17
- data/bin/server-build-messenger +13 -6
- data/bin/server-fire-cmd +1 -1
- data/bin/server-get-load +5 -16
- data/bin/server-list-active +3 -10
- data/bin/server-rerun +4 -4
- data/bin/server-send-command +18 -0
- data/bin/server-show-stats +17 -0
- data/bin/server-start-client +29 -0
- data/bin/server-start-master +13 -14
- data/bin/server-start-node +14 -15
- data/bin/server-stop-client +3 -0
- data/bin/server-stop-master +3 -0
- data/bin/server-stop-node +3 -0
- data/bin/server-update-hosts +48 -0
- data/config/hoe.rb +4 -3
- data/examples/plugin_without_plugin_directory.rb +1 -2
- data/generators/poolspec/USAGE +2 -2
- data/generators/poolspec/poolspec_generator.rb +2 -1
- data/generators/poolspec/templates/pool_spec_template.erb +3 -2
- data/lib/erlang/messenger/Rakefile +12 -0
- data/lib/erlang/messenger/ebin/client.app +19 -0
- data/lib/erlang/messenger/ebin/master.app +1 -1
- data/lib/erlang/messenger/ebin/node.app +1 -1
- data/lib/erlang/messenger/ebin/pm_client_rel-0.1.rel +1 -0
- data/lib/erlang/messenger/ebin/pm_master_rel-0.1.rel +1 -1
- data/lib/erlang/messenger/ebin/pm_node_rel-0.1.rel +1 -1
- data/lib/erlang/messenger/include/defines.hrl +27 -0
- data/lib/erlang/messenger/lib/eunit/.svn/all-wcprops +53 -0
- data/lib/erlang/messenger/lib/eunit/.svn/entries +140 -0
- data/lib/erlang/messenger/lib/eunit/.svn/format +1 -0
- data/lib/erlang/messenger/lib/eunit/.svn/prop-base/NOTES.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/.svn/text-base/AUTHORS.svn-base +2 -0
- data/lib/erlang/messenger/lib/eunit/.svn/text-base/CHANGELOG.svn-base +14 -0
- data/lib/erlang/messenger/lib/eunit/.svn/text-base/COPYING.svn-base +504 -0
- data/lib/erlang/messenger/lib/eunit/.svn/text-base/NOTES.svn-base +276 -0
- data/lib/erlang/messenger/lib/eunit/.svn/text-base/README.svn-base +3 -0
- data/lib/erlang/messenger/lib/eunit/.svn/text-base/sys.config.svn-base +9 -0
- data/lib/erlang/messenger/lib/eunit/.svn/text-base/vsn.mk.svn-base +1 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/all-wcprops +59 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/entries +142 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/format +1 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/erlang.png.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/eunit.html.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/index.html.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/modules-frame.html.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/overview-summary.html.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/packages-frame.html.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/edoc-info.svn-base +3 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/erlang.png.svn-base +0 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/eunit.html.svn-base +172 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/index.html.svn-base +17 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/modules-frame.html.svn-base +12 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/overview-summary.html.svn-base +984 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/overview.edoc.svn-base +980 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/packages-frame.html.svn-base +11 -0
- data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/stylesheet.css.svn-base +55 -0
- data/lib/erlang/messenger/lib/eunit/ebin/.svn/all-wcprops +5 -0
- data/lib/erlang/messenger/lib/eunit/ebin/.svn/dir-prop-base +8 -0
- data/lib/erlang/messenger/lib/eunit/ebin/.svn/entries +28 -0
- data/lib/erlang/messenger/lib/eunit/ebin/.svn/format +1 -0
- data/lib/erlang/messenger/lib/eunit/examples/.svn/all-wcprops +23 -0
- data/lib/erlang/messenger/lib/eunit/examples/.svn/entries +66 -0
- data/lib/erlang/messenger/lib/eunit/examples/.svn/format +1 -0
- data/lib/erlang/messenger/lib/eunit/examples/.svn/prop-base/eunit_examples.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/examples/.svn/prop-base/fib.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/examples/.svn/text-base/eunit_examples.erl.svn-base +339 -0
- data/lib/erlang/messenger/lib/eunit/examples/.svn/text-base/fib.erl.svn-base +19 -0
- data/lib/erlang/messenger/lib/eunit/examples/.svn/text-base/tests.txt.svn-base +1 -0
- data/lib/erlang/messenger/lib/eunit/include/.svn/all-wcprops +11 -0
- data/lib/erlang/messenger/lib/eunit/include/.svn/entries +41 -0
- data/lib/erlang/messenger/lib/eunit/include/.svn/format +1 -0
- data/lib/erlang/messenger/lib/eunit/include/.svn/prop-base/eunit.hrl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/include/.svn/text-base/eunit.hrl.svn-base +313 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/all-wcprops +113 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/entries +259 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/format +1 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/autoload.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/code_monitor.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_autoexport.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_data.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_internal.hrl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_lib.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_proc.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_serial.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_server.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_striptests.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_test.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_tests.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_tty.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/file_monitor.erl.svn-base +5 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/autoload.erl.svn-base +388 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/code_monitor.erl.svn-base +243 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit.app.src.svn-base +21 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit.appup.src.svn-base +1 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit.erl.svn-base +196 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_autoexport.erl.svn-base +102 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_data.erl.svn-base +798 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_internal.hrl.svn-base +48 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_lib.erl.svn-base +682 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_proc.erl.svn-base +552 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_serial.erl.svn-base +157 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_server.erl.svn-base +340 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_striptests.erl.svn-base +64 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_test.erl.svn-base +334 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_tests.erl.svn-base +45 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_tty.erl.svn-base +272 -0
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/file_monitor.erl.svn-base +409 -0
- data/lib/erlang/messenger/pm_client_rel-0.1.boot +0 -0
- data/lib/erlang/messenger/pm_client_rel-0.1.script +238 -0
- data/lib/erlang/messenger/pm_master_rel-0.1.boot +0 -0
- data/lib/erlang/messenger/pm_master_rel-0.1.script +82 -85
- data/lib/erlang/messenger/pm_node_rel-0.1.boot +0 -0
- data/lib/erlang/messenger/pm_node_rel-0.1.script +80 -85
- data/lib/erlang/messenger/src/client_app.erl +39 -0
- data/lib/erlang/messenger/src/client_server.erl +60 -0
- data/lib/erlang/messenger/src/pm_client.erl +48 -18
- data/lib/erlang/messenger/src/pm_client_old.erl +52 -0
- data/lib/erlang/messenger/src/pm_client_supervisor.erl +38 -0
- data/lib/erlang/messenger/src/pm_cluster.erl +20 -16
- data/lib/erlang/messenger/src/pm_event_manager.erl +27 -0
- data/lib/erlang/messenger/src/pm_master.erl +126 -34
- data/lib/erlang/messenger/src/pm_master_event_handler.erl +72 -0
- data/lib/erlang/messenger/src/pm_master_supervisor.erl +9 -10
- data/lib/erlang/messenger/src/pm_node.erl +107 -30
- data/lib/erlang/messenger/src/pm_node_supervisor.erl +13 -15
- data/lib/erlang/messenger/src/pm_packager.erl +5 -2
- data/lib/erlang/messenger/src/pm_strings.erl +11 -0
- data/lib/erlang/messenger/src/utils.erl +43 -8
- data/lib/erlang/messenger/useful_snippets +17 -0
- data/lib/poolparty/aska/aska.rb +150 -0
- data/lib/poolparty/base_packages/haproxy.rb +19 -26
- data/lib/poolparty/base_packages/heartbeat.rb +48 -47
- data/lib/poolparty/base_packages/poolparty.rb +88 -36
- data/lib/poolparty/base_packages/runit.rb +21 -0
- data/lib/poolparty/config/postlaunchmessage.txt +5 -0
- data/lib/poolparty/core/array.rb +4 -1
- data/lib/poolparty/core/class.rb +2 -0
- data/lib/poolparty/core/exception.rb +2 -1
- data/lib/poolparty/core/hash.rb +2 -2
- data/lib/poolparty/core/kernel.rb +3 -3
- data/lib/poolparty/core/metaid.rb +15 -0
- data/lib/poolparty/core/object.rb +42 -2
- data/lib/poolparty/core/string.rb +21 -6
- data/lib/poolparty/core/symbol.rb +9 -0
- data/lib/poolparty/dependency_resolutions/puppet.rb +20 -7
- data/lib/poolparty/exceptions/CloudNotFoundException.rb +7 -0
- data/lib/poolparty/exceptions/LoadRulesException.rb +7 -0
- data/lib/poolparty/exceptions/MasterException.rb +10 -0
- data/lib/poolparty/helpers/binary.rb +37 -4
- data/lib/poolparty/helpers/console.rb +25 -8
- data/lib/poolparty/helpers/nice_printer.rb +36 -0
- data/lib/poolparty/helpers/optioner.rb +51 -16
- data/lib/poolparty/helpers/provisioner_base.rb +117 -28
- data/lib/poolparty/helpers/provisioners/master.rb +102 -35
- data/lib/poolparty/helpers/provisioners/slave.rb +25 -9
- data/lib/poolparty/modules/cloud_dsl.rb +13 -0
- data/lib/poolparty/modules/cloud_resourcer.rb +51 -8
- data/lib/poolparty/modules/configurable.rb +1 -1
- data/lib/poolparty/modules/definable_resource.rb +2 -2
- data/lib/poolparty/modules/file_writer.rb +37 -6
- data/lib/poolparty/modules/method_missing_sugar.rb +8 -3
- data/lib/poolparty/modules/pretty_printer.rb +1 -0
- data/lib/poolparty/modules/resourcing_dsl.rb +4 -2
- data/lib/poolparty/modules/thread_pool.rb +106 -0
- data/lib/poolparty/monitors/base_monitor.rb +65 -6
- data/lib/poolparty/monitors/monitors/cpu_monitor.rb +1 -1
- data/lib/poolparty/monitors/monitors/memory_monitor.rb +28 -1
- data/lib/poolparty/monitors/monitors/web_monitor.rb +18 -0
- data/lib/poolparty/net/messenger.rb +72 -0
- data/lib/poolparty/net/remote.rb +5 -2
- data/lib/poolparty/net/remote_bases/ec2/ec2_response_object.rb +66 -0
- data/lib/poolparty/net/remote_bases/ec2.rb +133 -131
- data/lib/poolparty/net/remote_instance.rb +28 -6
- data/lib/poolparty/net/remoter.rb +117 -64
- data/lib/poolparty/net/remoter_base.rb +49 -11
- data/lib/poolparty/plugins/deploydirectory.rb +66 -0
- data/lib/poolparty/plugins/line.rb +5 -4
- data/lib/poolparty/plugins/rsyncmirror.rb +26 -0
- data/lib/poolparty/plugins/runit.rb +96 -0
- data/lib/poolparty/plugins/svn.rb +1 -1
- data/lib/poolparty/pool/base.rb +47 -18
- data/lib/poolparty/pool/cloud.rb +121 -65
- data/lib/poolparty/pool/custom_resource.rb +4 -20
- data/lib/poolparty/pool/loggable.rb +3 -8
- data/lib/poolparty/pool/plugin.rb +14 -19
- data/lib/poolparty/pool/plugin_model.rb +8 -8
- data/lib/poolparty/pool/pool.rb +28 -11
- data/lib/poolparty/pool/resource.rb +109 -40
- data/lib/poolparty/pool/resources/class_package.rb +74 -33
- data/lib/poolparty/pool/resources/conditional.rb +32 -10
- data/lib/poolparty/pool/resources/custom_service.rb +30 -0
- data/lib/poolparty/pool/resources/exec.rb +6 -5
- data/lib/poolparty/pool/resources/gem_package.rb +52 -0
- data/lib/poolparty/pool/resources/mount.rb +22 -0
- data/lib/poolparty/pool/resources/package.rb +13 -3
- data/lib/poolparty/pool/resources/sshkey.rb +1 -1
- data/lib/poolparty/pool/resources/variable.rb +4 -0
- data/lib/poolparty/pool/script.rb +8 -6
- data/lib/poolparty/templates/haproxy.conf +1 -1
- data/lib/poolparty/templates/messenger/client/log-run.erb +2 -0
- data/lib/poolparty/templates/messenger/client/run.erb +4 -0
- data/lib/poolparty/templates/messenger/master/log-run.erb +2 -0
- data/lib/poolparty/templates/messenger/master/run.erb +4 -0
- data/lib/poolparty/templates/messenger/node/log-run.erb +2 -0
- data/lib/poolparty/templates/messenger/node/run.erb +4 -0
- data/lib/poolparty/templates/poolparty.monitor +1 -1
- data/lib/poolparty/templates/puppet.conf +0 -0
- data/lib/poolparty/templates/puppetcleaner +6 -0
- data/lib/poolparty/templates/puppetrerun +9 -0
- data/lib/poolparty/templates/puppetrunner +8 -0
- data/lib/poolparty/templates/yaws.conf +19 -0
- data/lib/poolparty/version.rb +1 -1
- data/lib/poolparty.rb +35 -6
- data/lib/poolpartycl.rb +4 -0
- data/log/pool.logs +0 -0
- data/poolparty.gemspec +574 -61
- data/spec/poolparty/aska/aska_spec.rb +122 -0
- data/spec/poolparty/bin/console_spec.rb +18 -0
- data/spec/poolparty/core/hash_spec.rb +4 -4
- data/spec/poolparty/core/object_spec.rb +29 -0
- data/spec/poolparty/core/string_spec.rb +6 -0
- data/spec/poolparty/core/time_spec.rb +0 -3
- data/spec/poolparty/helpers/binary_spec.rb +2 -2
- data/spec/poolparty/helpers/optioner_spec.rb +1 -4
- data/spec/poolparty/helpers/provisioner_base_spec.rb +14 -1
- data/spec/poolparty/helpers/provisioners/master_spec.rb +3 -3
- data/spec/poolparty/modules/cloud_resourcer_spec.rb +3 -3
- data/spec/poolparty/modules/configurable_spec.rb +4 -1
- data/spec/poolparty/monitors/base_monitor_spec.rb +94 -2
- data/spec/poolparty/monitors/monitors/cpu_monitor_spec.rb +0 -1
- data/spec/poolparty/monitors/monitors/memory_monitor_spec.rb +47 -0
- data/spec/poolparty/{helpers → net}/messenger_spec.rb +3 -1
- data/spec/poolparty/net/remote_bases/ec2_spec.rb +46 -5
- data/spec/poolparty/net/remote_instance_spec.rb +2 -1
- data/spec/poolparty/net/remote_spec.rb +30 -8
- data/spec/poolparty/net/remoter_base_spec.rb +4 -1
- data/spec/poolparty/net/remoter_spec.rb +11 -108
- data/spec/poolparty/plugins/deploydirectory_spec.rb +51 -0
- data/spec/poolparty/pool/base_spec.rb +43 -33
- data/spec/poolparty/pool/cloud_spec.rb +299 -248
- data/spec/poolparty/pool/custom_resource_spec.rb +10 -5
- data/spec/poolparty/pool/example_spec.rb +0 -84
- data/spec/poolparty/pool/plugin_model_spec.rb +3 -2
- data/spec/poolparty/pool/plugin_spec.rb +89 -62
- data/spec/poolparty/pool/pool_spec.rb +17 -2
- data/spec/poolparty/pool/resource_spec.rb +341 -236
- data/spec/poolparty/pool/resources/class_package_spec.rb +102 -66
- data/spec/poolparty/pool/resources/conditional_spec.rb +65 -26
- data/spec/poolparty/pool/resources/cron_spec.rb +3 -2
- data/spec/poolparty/pool/resources/exec_spec.rb +1 -1
- data/spec/poolparty/pool/resources/gem_spec.rb +18 -14
- data/spec/poolparty/pool/resources/remote_file_spec.rb +1 -1
- data/spec/poolparty/pool/resources/variable_spec.rb +1 -1
- data/spec/poolparty/pool/script_spec.rb +58 -37
- data/spec/poolparty/pool/test_plugins/webserver.rb +1 -0
- data/spec/poolparty/spec_helper.rb +16 -5
- data/tasks/deployment.rake +19 -3
- data/tasks/development.rake +11 -2
- data/tasks/ec2.rake +9 -1
- data/website/index.html +2 -2
- metadata +167 -70
- data/bin/pool-provision +0 -34
- data/erl_crash.dump +0 -8409
- data/examples/with_apache_plugin.rb +0 -22
- data/lib/erlang/messenger/Makefile +0 -15
- data/lib/erlang/messenger/ebin/master_app.beam +0 -0
- data/lib/erlang/messenger/ebin/node_app.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_client.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_cluster.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_event_handler.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_master.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_master_supervisor.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_node.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_node_supervisor.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_packager.beam +0 -0
- data/lib/erlang/messenger/ebin/utils.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/Makefile +0 -28
- data/lib/erlang/messenger/lib/eunit/ebin/autoload.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/code_monitor.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_autoexport.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_data.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_lib.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_proc.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_serial.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_server.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_striptests.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_test.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_tests.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit_tty.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/ebin/file_monitor.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/src/Makefile +0 -46
- data/lib/erlang/messenger/src/pm_event_handler.erl +0 -21
- data/lib/poolparty/config/allowed_commands.yml +0 -1
- data/lib/poolparty/helpers/messenger.rb +0 -29
- data/lib/poolparty/plugins/git.rb +0 -39
- data/lib/poolparty/pool/resources/gem.rb +0 -28
- data/lib/poolparty/pool/tmp/.ppkeys +0 -3
- data/lib/poolparty/pool/tmp/happydayz +0 -1
- data/lib/poolparty/pool/tmp/install_master.sh +0 -33
- data/lib/poolparty/pool/tmp/pool.spec +0 -11
- data/lib/poolparty/pool/tmp/poolparty.pp +0 -600
- data/lib/poolparty/pool/tmp/tc-instances.list +0 -1
- data/lib/poolparty/templates/fileserver.conf +0 -4
- data/spec/poolparty/plugins/git_spec.rb +0 -33
- data/test_manifest.pp +0 -658
|
@@ -7,13 +7,12 @@ require File.dirname(__FILE__) + "/../helpers/provisioner_base"
|
|
|
7
7
|
module PoolParty
|
|
8
8
|
module Remote
|
|
9
9
|
module Remoter
|
|
10
|
-
def rsync_storage_files_to_command(remote_instance)
|
|
11
|
-
if remote_instance
|
|
12
|
-
"#{rsync_command} #{Base.storage_directory}/ #{remote_instance.ip}:#{Base.remote_storage_path}"
|
|
13
|
-
end
|
|
10
|
+
def rsync_storage_files_to_command(remote_instance)
|
|
11
|
+
"#{rsync_command} #{Base.storage_directory}/ #{remote_instance.ip}:#{Base.remote_storage_path}" if remote_instance
|
|
14
12
|
end
|
|
15
13
|
def run_command_on_command(cmd="ls -l", remote_instance=nil)
|
|
16
|
-
"#{
|
|
14
|
+
vputs "Running #{cmd} on #{remote_instance.name == %x[hostname].chomp ? "self (master)" : "#{remote_instance.name}"}"
|
|
15
|
+
remote_instance.name == %x[hostname].chomp ? %x[#{cmd}] : "#{ssh_command(remote_instance)} '#{cmd}'"
|
|
17
16
|
end
|
|
18
17
|
def ssh_command(remote_instance)
|
|
19
18
|
"#{ssh_string} #{remote_instance.ip}"
|
|
@@ -30,31 +29,16 @@ module PoolParty
|
|
|
30
29
|
["-o StrictHostKeyChecking=no", "-l '#{Base.user}'", '-i "'+full_keypair_path+'"']
|
|
31
30
|
end
|
|
32
31
|
def rsync_command
|
|
33
|
-
"rsync
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
else
|
|
46
|
-
out = list_from_remote(:cache => true)
|
|
47
|
-
end
|
|
48
|
-
return out
|
|
49
|
-
end
|
|
50
|
-
# List the instances that are known from the remoter_base
|
|
51
|
-
# Create a RemoteInstance for each of the instances from the hash
|
|
52
|
-
# returned by the list of instances, write them to the cached file
|
|
53
|
-
# and then return the array of instances
|
|
54
|
-
def list_from_remote(options={})
|
|
55
|
-
out_array = get_remote_nodes
|
|
56
|
-
write_to_file( local_instances_list_file_locations.first, out_array.map{|a| a.to_s }.join("\n")) if options[:cache]
|
|
57
|
-
out_array
|
|
32
|
+
"rsync -azP --exclude cache -e '#{ssh_string}'"
|
|
33
|
+
end
|
|
34
|
+
def remote_ssh_array
|
|
35
|
+
["-o StrictHostKeyChecking=no", "-l '#{Base.user}'", '-i "'+remote_keypair_path+'"']
|
|
36
|
+
end
|
|
37
|
+
def remote_ssh_string
|
|
38
|
+
(["ssh"] << remote_ssh_array).join(" ")
|
|
39
|
+
end
|
|
40
|
+
def remote_rsync_command
|
|
41
|
+
"rsync -azP --exclude cache -e '#{remote_ssh_string}'"
|
|
58
42
|
end
|
|
59
43
|
# Get the names of the nodes. Mainly used for puppet templating
|
|
60
44
|
def list_of_node_names(options={})
|
|
@@ -64,13 +48,7 @@ module PoolParty
|
|
|
64
48
|
def list_of_node_ips(options={})
|
|
65
49
|
list_of_running_instances.collect {|ri| ri.ip }
|
|
66
50
|
end
|
|
67
|
-
|
|
68
|
-
returning Array.new do |instances|
|
|
69
|
-
list_of_instances(respond_to?(:keypair) ? keypair : nil).each do |h|
|
|
70
|
-
instances << PoolParty::Remote::RemoteInstance.new(h)
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
end
|
|
51
|
+
|
|
74
52
|
# Get the instance first instance file that exists on the system from the expected places
|
|
75
53
|
# denoted in the local_instances_list_file_locations
|
|
76
54
|
def get_working_listing_file
|
|
@@ -103,6 +81,14 @@ module PoolParty
|
|
|
103
81
|
num.times {out << launch_new_instance!}
|
|
104
82
|
out
|
|
105
83
|
end
|
|
84
|
+
def request_launch_master_instance
|
|
85
|
+
inst = launch_new_instance!
|
|
86
|
+
wait "5.seconds"
|
|
87
|
+
when_no_pending_instances {after_launch_master(inst)}
|
|
88
|
+
end
|
|
89
|
+
def after_launch_master(h={})
|
|
90
|
+
vputs "After launch master in remoter"
|
|
91
|
+
end
|
|
106
92
|
# Let's terminate an instance that is not the master instance
|
|
107
93
|
def request_termination_of_non_master_instance
|
|
108
94
|
inst = nonmaster_nonterminated_instances.last
|
|
@@ -110,12 +96,16 @@ module PoolParty
|
|
|
110
96
|
end
|
|
111
97
|
# Can we start a new instance?
|
|
112
98
|
def can_start_a_new_instance?
|
|
113
|
-
maximum_number_of_instances_are_not_running?
|
|
99
|
+
maximum_number_of_instances_are_not_running? && list_of_pending_instances.size == 0
|
|
114
100
|
end
|
|
115
|
-
# Are the maximum number of instances running?
|
|
101
|
+
# Are the maximum number of instances not running?
|
|
116
102
|
def maximum_number_of_instances_are_not_running?
|
|
117
103
|
list_of_running_instances.size < maximum_instances.to_i
|
|
118
104
|
end
|
|
105
|
+
# Are the maximum number of instances running?
|
|
106
|
+
def maximum_number_of_instances_are_running?
|
|
107
|
+
list_of_running_instances.size >= maximum_instances.to_i
|
|
108
|
+
end
|
|
119
109
|
# Launch new instance while waiting for the number of pending instances
|
|
120
110
|
# to be zero before actually launching. This ensures that we only
|
|
121
111
|
# launch one instance at a time
|
|
@@ -125,14 +115,28 @@ module PoolParty
|
|
|
125
115
|
# A convenience method for waiting until there are no more
|
|
126
116
|
# pending instances and then running the block
|
|
127
117
|
def when_no_pending_instances(&block)
|
|
128
|
-
reset!
|
|
118
|
+
reset!
|
|
129
119
|
if list_of_pending_instances.size == 0
|
|
130
120
|
block.call if block
|
|
131
121
|
else
|
|
122
|
+
vprint "."
|
|
132
123
|
wait "5.seconds"
|
|
133
124
|
when_no_pending_instances(&block)
|
|
134
125
|
end
|
|
135
126
|
end
|
|
127
|
+
# A convenience method for waiting until all the instances have an ip
|
|
128
|
+
# assigned to them. This is useful when shifting the ip addresses
|
|
129
|
+
# around on the instances
|
|
130
|
+
def when_all_assigned_ips(&block)
|
|
131
|
+
reset!
|
|
132
|
+
if list_of_nonterminated_instances.select {|a| a.ip == "not.assigned" }.empty?
|
|
133
|
+
block.call if block
|
|
134
|
+
else
|
|
135
|
+
vprint "."
|
|
136
|
+
wait "5.seconds"
|
|
137
|
+
when_all_assigned_ips(&block)
|
|
138
|
+
end
|
|
139
|
+
end
|
|
136
140
|
|
|
137
141
|
# This will launch the minimum_instances if the minimum number of instances are not running
|
|
138
142
|
# If the minimum number of instances are not running and if we can start a new instance
|
|
@@ -140,7 +144,30 @@ module PoolParty
|
|
|
140
144
|
if can_start_a_new_instance? && !minimum_number_of_instances_are_running?
|
|
141
145
|
list_of_pending_instances.size == 0 ? request_launch_one_instance_at_a_time : wait("5.seconds")
|
|
142
146
|
reset!
|
|
143
|
-
launch_minimum_number_of_instances
|
|
147
|
+
launch_minimum_number_of_instances
|
|
148
|
+
provision_slaves_from_n(minimum_instances.to_i)
|
|
149
|
+
after_launched
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
def provision_slaves_from_n(num=1)
|
|
154
|
+
vputs "In provision_slaves_from_n: #{num}"
|
|
155
|
+
reset!
|
|
156
|
+
when_no_pending_instances do
|
|
157
|
+
vputs "Waiting for 10 seconds"
|
|
158
|
+
wait "10.seconds" # Give some time for ssh to startup
|
|
159
|
+
@num_instances = list_of_running_instances.size
|
|
160
|
+
vputs "(@num_instances - (num))..(@num_instances): #{(@num_instances - (num))..(@num_instances)}"
|
|
161
|
+
last_instances = nonmaster_nonterminated_instances[(@num_instances - (num))..(@num_instances)]
|
|
162
|
+
last_instances.each do |inst|
|
|
163
|
+
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)}
|
|
167
|
+
# cmd = ". /etc/profile && cloud-provision -i #{inst.name.gsub(/node/, '')} &"
|
|
168
|
+
# vputs "Provision slave with command #{cmd}"
|
|
169
|
+
end
|
|
170
|
+
PoolParty::Provisioner.reconfigure_master(self)
|
|
144
171
|
end
|
|
145
172
|
end
|
|
146
173
|
# Launch the master and let the master handle the starting of the cloud
|
|
@@ -149,24 +176,35 @@ module PoolParty
|
|
|
149
176
|
# and if the master is not running AND we can start a new instance
|
|
150
177
|
# Then wait for the master to launch
|
|
151
178
|
def launch_and_configure_master!(testing=false)
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
179
|
+
vputs "Requesting to launch new instance"
|
|
180
|
+
logger.debug "Launching master"
|
|
181
|
+
request_launch_master_instance if list_of_pending_instances.size.zero? && can_start_a_new_instance? && !is_master_running? && !testing
|
|
182
|
+
reset!
|
|
183
|
+
unless testing
|
|
184
|
+
vputs ""
|
|
185
|
+
vputs "Waiting for there to be no pending instances..."
|
|
186
|
+
when_no_pending_instances do
|
|
187
|
+
when_all_assigned_ips {wait "20.seconds"}
|
|
188
|
+
vputs ""
|
|
189
|
+
vputs "Provisioning master..."
|
|
190
|
+
# 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) }
|
|
193
|
+
|
|
194
|
+
after_launched
|
|
195
|
+
end
|
|
157
196
|
end
|
|
158
|
-
|
|
159
197
|
end
|
|
160
198
|
def is_master_running?
|
|
161
199
|
!list_of_running_instances.select {|a| a.name == "master"}.first.nil?
|
|
162
200
|
end
|
|
163
201
|
# Stub method for the time being to handle expansion of the cloud
|
|
164
202
|
def should_expand_cloud?(force=false)
|
|
165
|
-
force || false
|
|
203
|
+
valid_rules?(:expand_when) || force || false
|
|
166
204
|
end
|
|
167
205
|
# Stub method for the time being to handle the contraction of the cloud
|
|
168
206
|
def should_contract_cloud?(force=false)
|
|
169
|
-
force || false
|
|
207
|
+
valid_rules?(:contract_when) || force || false
|
|
170
208
|
end
|
|
171
209
|
# Expand the cloud
|
|
172
210
|
# If we can start a new instance and the load requires us to expand
|
|
@@ -176,14 +214,14 @@ module PoolParty
|
|
|
176
214
|
# get go
|
|
177
215
|
def expand_cloud_if_necessary(force=false)
|
|
178
216
|
if can_start_a_new_instance? && should_expand_cloud?(force)
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
217
|
+
vputs "Expanding the cloud based on load"
|
|
218
|
+
@num = 1
|
|
219
|
+
@num.times do |i|
|
|
220
|
+
list_of_pending_instances.size == 0 ? request_launch_one_instance_at_a_time : wait("5.seconds")
|
|
221
|
+
reset!
|
|
222
|
+
vputs "request_launch_new_instances: #{@num}"
|
|
223
|
+
provision_slaves_from_n(@num)
|
|
224
|
+
after_launched
|
|
187
225
|
end
|
|
188
226
|
end
|
|
189
227
|
end
|
|
@@ -192,15 +230,29 @@ module PoolParty
|
|
|
192
230
|
# the cloud, then we should request_termination_of_non_master_instance
|
|
193
231
|
def contract_cloud_if_necessary(force=false)
|
|
194
232
|
if can_shutdown_an_instance?
|
|
195
|
-
|
|
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
|
|
196
238
|
end
|
|
197
239
|
end
|
|
198
240
|
|
|
241
|
+
# Callbacks
|
|
242
|
+
|
|
243
|
+
# After launch callback
|
|
244
|
+
# This is called after a new instance is launched
|
|
245
|
+
def after_launched(force=false)
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
# Before shutdown callback
|
|
249
|
+
# This is called before the cloud is contracted
|
|
250
|
+
def before_shutdown
|
|
251
|
+
end
|
|
252
|
+
|
|
199
253
|
# Rsync command to the instance
|
|
200
254
|
def rsync_storage_files_to(instance=nil)
|
|
201
|
-
hide_output
|
|
202
|
-
Kernel.system "#{rsync_storage_files_to_command(instance)}" if instance
|
|
203
|
-
end
|
|
255
|
+
hide_output {Kernel.system "#{rsync_storage_files_to_command(instance)}" if instance}
|
|
204
256
|
end
|
|
205
257
|
# Take the rsync command and execute it on the system
|
|
206
258
|
# if there is an instance given
|
|
@@ -224,12 +276,13 @@ module PoolParty
|
|
|
224
276
|
end
|
|
225
277
|
|
|
226
278
|
# Prepare reconfiguration on the master
|
|
227
|
-
# TODO: Fix the killall
|
|
228
279
|
# TODO: Curious about the puppet/ssl problems...
|
|
280
|
+
# puppetd --test --no-daemonize 2>&1 &
|
|
281
|
+
# rm -rf /etc/puppet/ssl/*;
|
|
229
282
|
def prepare_reconfiguration
|
|
230
283
|
unless @prepared
|
|
231
|
-
cmd = "
|
|
232
|
-
run_command_on(cmd, master)
|
|
284
|
+
# cmd = "/etc/init.d/puppetmaster restart"
|
|
285
|
+
# run_command_on(cmd, master)
|
|
233
286
|
@prepared = true
|
|
234
287
|
end
|
|
235
288
|
end
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
=begin rdoc
|
|
2
|
+
The base for Remote Bases
|
|
3
|
+
|
|
4
|
+
By extending this class, you can easily add remoters to
|
|
5
|
+
PoolParty. There are 4 methods that the remote base needs to implement
|
|
6
|
+
in order to be compatible.
|
|
7
|
+
|
|
8
|
+
The four methods are:
|
|
9
|
+
launch_new_instance!
|
|
10
|
+
terminate_instance(id)
|
|
11
|
+
describe_instance(id)
|
|
12
|
+
describe_instances
|
|
13
|
+
|
|
14
|
+
After your remote base is written, make sure to register the base outside the context
|
|
15
|
+
of the remote base, like so:
|
|
16
|
+
register_remote_base :remote_base_name
|
|
17
|
+
|
|
18
|
+
=end
|
|
1
19
|
module PoolParty
|
|
2
20
|
|
|
3
21
|
def register_remote_base(*args)
|
|
@@ -70,27 +88,47 @@ module PoolParty
|
|
|
70
88
|
name = (i.zero? ? "master" : "node#{i}")
|
|
71
89
|
list.select {|i| i.name == name }.first
|
|
72
90
|
end
|
|
73
|
-
def remote_instances_list
|
|
74
|
-
|
|
91
|
+
def remote_instances_list
|
|
92
|
+
@containing_cloud = self
|
|
93
|
+
# puts "> #{@containing_cloud} #{@describe_instances.nil?}"
|
|
94
|
+
list_of_instances(keypair).collect {|h| PoolParty::Remote::RemoteInstance.new(h, @containing_cloud) }
|
|
75
95
|
end
|
|
76
96
|
# List the instances for the current key pair, regardless of their states
|
|
77
97
|
# If no keypair is passed, select them all
|
|
78
98
|
def list_of_instances(keyp=nil)
|
|
79
|
-
|
|
80
|
-
|
|
99
|
+
tmp_key = (keyp ? keyp : keypair).to_s
|
|
100
|
+
unless @describe_instances
|
|
101
|
+
tmpInstanceList = describe_instances.select {|a| a if tmp_key ? a[:keypair] == tmp_key : true }
|
|
102
|
+
has_master = !tmpInstanceList.select {|a| a[:name] == "master" }.empty?
|
|
103
|
+
if has_master
|
|
104
|
+
@describe_instances = tmpInstanceList
|
|
105
|
+
else
|
|
106
|
+
@id = 0
|
|
107
|
+
running = select_from_instances_on_status(/running/, tmpInstanceList)
|
|
108
|
+
pending = select_from_instances_on_status(/pending/, tmpInstanceList)
|
|
109
|
+
terminated = select_from_instances_on_status(/shutting/, tmpInstanceList)
|
|
110
|
+
|
|
111
|
+
running = running.map do |inst|
|
|
112
|
+
inst[:name] = (@id == 0 ? "master" : "node#{@id}")
|
|
113
|
+
@id += 1
|
|
114
|
+
inst
|
|
115
|
+
end.sort_by {|a| a[:index] }
|
|
116
|
+
|
|
117
|
+
@describe_instances = [running, pending, terminated].flatten
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
@describe_instances
|
|
81
121
|
end
|
|
82
|
-
#
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
# remote_instances_list.select {|a| a.master }.first
|
|
86
|
-
@list = list_from_remote
|
|
87
|
-
@list.reject {|a| a unless a.name =~ /master/ }.first if @list.class != String
|
|
122
|
+
# Select the instances based on their status
|
|
123
|
+
def select_from_instances_on_status(status=/running/, list=[])
|
|
124
|
+
list.select {|a| a[:status] =~ status}
|
|
88
125
|
end
|
|
89
126
|
# Helpers
|
|
90
127
|
def create_keypair
|
|
91
128
|
end
|
|
92
129
|
# Reset the cache of descriptions
|
|
93
|
-
def
|
|
130
|
+
def reset_remoter_base!
|
|
131
|
+
@describe_instances = nil
|
|
94
132
|
end
|
|
95
133
|
def self.included(other)
|
|
96
134
|
PoolParty.register_remote_base(self.class.to_s.downcase.to_sym)
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
=begin rdoc
|
|
2
|
+
DeployDirectory
|
|
3
|
+
|
|
4
|
+
Deploy directory will tar.gz a local directory and sync it up to
|
|
5
|
+
the master instance of the cloud. This enables you to send a directory
|
|
6
|
+
up to the cloud and let the master host it for the remote slaves
|
|
7
|
+
=end
|
|
8
|
+
module PoolParty
|
|
9
|
+
class Deploydirectory
|
|
10
|
+
|
|
11
|
+
virtual_resource(:deploydirectory) do
|
|
12
|
+
|
|
13
|
+
def loaded(opts={}, parent=self)
|
|
14
|
+
package_directory
|
|
15
|
+
unpack_directory
|
|
16
|
+
sync_directories
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def package_directory
|
|
20
|
+
path = ::File.join( Base.tmp_path, "#{::File.basename(from_dir)}.tar.gz" )
|
|
21
|
+
archive_name = "#{name.dir_safe}.tar.gz"
|
|
22
|
+
cmd = "cd #{::File.expand_path(from_dir)} && tar -czf #{archive_name} . && mv #{archive_name} #{Base.tmp_path}"
|
|
23
|
+
`#{cmd}` unless testing
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def unpack_directory
|
|
27
|
+
execute_on_master do
|
|
28
|
+
has_exec({:name => "deploy-directory-#{name}", :requires => get_directory("#{cwd}"), :cwd => cwd}) do
|
|
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"
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def sync_directories
|
|
37
|
+
execute_on_node do
|
|
38
|
+
has_rsyncmirror(:dir => cwd, :name => "deploydirectory-#{name}")
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def from(dir)
|
|
43
|
+
from_dir (dir.include?(" ") ? dir.gsub(/[ ]/, '') : dir)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def to(dir)
|
|
47
|
+
cwd dir
|
|
48
|
+
has_directory(:name => "#{dir}", :requires => get_directory("#{::File.dirname(dir)}"))
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Since git is not a native type, we have to say which core resource
|
|
52
|
+
# it is using to be able to require it
|
|
53
|
+
def class_type_name
|
|
54
|
+
"exec"
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
# Because we are requiring an exec, instead of a built-in package of the git, we have to overload
|
|
58
|
+
# the to_s method and prepend it with the same name as above
|
|
59
|
+
def key
|
|
60
|
+
"deploy-directory-#{name}"
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
end
|
|
66
|
+
end
|
|
@@ -4,7 +4,7 @@ module PoolParty
|
|
|
4
4
|
define_resource(:line_in_file) do
|
|
5
5
|
# Should refactor
|
|
6
6
|
def has_line_in_file(line="line_in_file", file="file", opts={})
|
|
7
|
-
|
|
7
|
+
call_custom_function <<-EOE
|
|
8
8
|
line {
|
|
9
9
|
'#{file}_line' :
|
|
10
10
|
file => '#{file}',
|
|
@@ -16,7 +16,7 @@ module PoolParty
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def append_if_no_such_line(line="line", file="", refreshonly='false')
|
|
19
|
-
|
|
19
|
+
call_custom_function <<-EOE
|
|
20
20
|
append_if_no_such_line {
|
|
21
21
|
'#{file}' :
|
|
22
22
|
file => '#{file}',
|
|
@@ -26,11 +26,12 @@ module PoolParty
|
|
|
26
26
|
EOE
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
def delete_lines_from(file="", pattern
|
|
30
|
-
|
|
29
|
+
def delete_lines_from(file="", pattern=//, opts={})
|
|
30
|
+
call_custom_function <<-EOE
|
|
31
31
|
delete_lines {
|
|
32
32
|
'#{file}' :
|
|
33
33
|
file => '#{file}',
|
|
34
|
+
#{opts.flush_out("\t", ",")}
|
|
34
35
|
pattern => '#{pattern}'
|
|
35
36
|
}
|
|
36
37
|
EOE
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module PoolParty
|
|
2
|
+
class Rsyncmirror
|
|
3
|
+
|
|
4
|
+
virtual_resource(:rsyncmirror) do
|
|
5
|
+
|
|
6
|
+
def loaded(opts={}, parent=self)
|
|
7
|
+
@parent = parent
|
|
8
|
+
has_exec(opts.merge({:command => "#{cloud.remote_rsync_command} --no-implied-dirs --delete-excluded #{Base.user}@master:#{dir}/ #{dir}/".safe_quote, :name => "rsync-#{name}"}))
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# Since git is not a native type, we have to say which core resource
|
|
12
|
+
# it is using to be able to require it
|
|
13
|
+
def class_type_name
|
|
14
|
+
"exec"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Because we are requiring an exec, instead of a built-in package of the git, we have to overload
|
|
18
|
+
# the to_s method and prepend it with the same name as above
|
|
19
|
+
def key
|
|
20
|
+
"rsync-#{name}"
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
module PoolParty
|
|
2
|
+
class Runit
|
|
3
|
+
define_resource(:runitservice) do
|
|
4
|
+
def has_runit_service(name="runitservice", downif="", templatedir="")
|
|
5
|
+
path = copy_templates_from_templatedir(templatedir)
|
|
6
|
+
call_custom_function <<-EOC
|
|
7
|
+
runit_service {
|
|
8
|
+
"#{name}":
|
|
9
|
+
directory => "/etc/sv",
|
|
10
|
+
downif => "/bin/ps aux | grep -v grep | grep -q #{downif}",
|
|
11
|
+
templatedir => "#{path}";
|
|
12
|
+
}
|
|
13
|
+
EOC
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def copy_templates_from_templatedir(dir=nil)
|
|
17
|
+
raise TemplateNotFound.new("template directory given") unless dir
|
|
18
|
+
raise TemplateNotFound.new("template directory cannot be found #{dir}") unless ::File.readable?(dir)
|
|
19
|
+
copy_directory_into_template_storage_directory(dir)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
custom_function <<-EOF
|
|
23
|
+
define runit_service ($directory = "/etc/sv", $downif = "/bin/false", $templatedir) {
|
|
24
|
+
|
|
25
|
+
file { "$directory-$name":
|
|
26
|
+
path => "$directory/$name",
|
|
27
|
+
ensure => directory,
|
|
28
|
+
owner => root,
|
|
29
|
+
group => root,
|
|
30
|
+
mode => 0755,
|
|
31
|
+
require => Class["runit"]
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
file { "$directory/$name/log":
|
|
35
|
+
ensure => directory,
|
|
36
|
+
owner => root,
|
|
37
|
+
group => root,
|
|
38
|
+
mode => 0755,
|
|
39
|
+
require => File["$directory-$name"]
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
file { "$directory/$name/log/main":
|
|
43
|
+
ensure => directory,
|
|
44
|
+
owner => root,
|
|
45
|
+
group => root,
|
|
46
|
+
mode => 0755,
|
|
47
|
+
require => File["$directory/$name/log"]
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
file { "/etc/init.d/$name":
|
|
51
|
+
ensure => $lsbdistid ? {
|
|
52
|
+
'CentOS' => "/usr/local/bin/sv",
|
|
53
|
+
default => "/usr/bin/sv",
|
|
54
|
+
},
|
|
55
|
+
require => [ File["$directory/$name/run"], File["$directory/$name/log/run"] ]
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
file { "/var/service/$name":
|
|
59
|
+
ensure => "$directory/$name",
|
|
60
|
+
require => [ File["$directory-$name"], File["$directory/$name/run"], File["$directory/$name/log/run"] ]
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
file { "$directory/$name/log/run":
|
|
64
|
+
content => template("$templatedir/log-run.erb"),
|
|
65
|
+
owner => root,
|
|
66
|
+
group => root,
|
|
67
|
+
mode => 755,
|
|
68
|
+
require => File["$directory/$name/log"],
|
|
69
|
+
notify => Service[$name]
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
file { "$directory/$name/run":
|
|
73
|
+
content => template("$templatedir/run.erb"),
|
|
74
|
+
owner => root,
|
|
75
|
+
group => root,
|
|
76
|
+
mode => 755,
|
|
77
|
+
require => File["$directory-$name"],
|
|
78
|
+
notify => Service[$name]
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
service { "$name":
|
|
82
|
+
hasrestart => true,
|
|
83
|
+
hasstatus => true,
|
|
84
|
+
require => File["/etc/init.d/$name"]
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
exec { "$name-down":
|
|
88
|
+
command => "/etc/init.d/$name down",
|
|
89
|
+
onlyif => $downif,
|
|
90
|
+
require => File["/etc/init.d/$name"]
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
EOF
|
|
94
|
+
end
|
|
95
|
+
end
|
|
96
|
+
end
|