poolparty 0.2.69 → 0.2.84
Sign up to get free protection for your applications and to get access to all the features.
- data/Capfile +1 -0
- data/History.txt +6 -0
- data/Manifest.txt +140 -143
- data/PostInstall.txt +1 -1
- data/README.txt +2 -0
- data/bin/cloud-configure +5 -2
- data/bin/cloud-handle-load +3 -3
- data/bin/cloud-maintain +3 -3
- data/bin/cloud-provision +6 -5
- data/bin/cloud-rsync +28 -0
- data/bin/cloud-setup-dev +25 -0
- data/bin/cloud-spec +40 -0
- data/bin/cloud-start +5 -3
- data/bin/server-clean-cert-for +15 -0
- data/bin/server-rerun +0 -1
- data/bin/server-start-client +1 -1
- data/bin/server-start-master +1 -1
- data/bin/server-start-node +1 -1
- data/bin/server-update-hosts +4 -3
- data/bin/server-write-new-nodes +26 -0
- data/generators/poolspec/USAGE +2 -2
- data/generators/poolspec/poolspec_generator.rb +1 -1
- data/lib/erlang/messenger/Makefile +15 -0
- data/lib/erlang/messenger/ebin/client_app.beam +0 -0
- data/lib/erlang/messenger/ebin/client_server.beam +0 -0
- data/lib/erlang/messenger/ebin/erl_crash.dump +10326 -0
- 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_client_old.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_client_supervisor.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_cluster.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_event_manager.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_master.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_master_event_handler.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/pm_spawner.beam +0 -0
- data/lib/erlang/messenger/ebin/pm_strings.beam +0 -0
- data/lib/erlang/messenger/ebin/utils.beam +0 -0
- data/lib/erlang/messenger/lib/eunit/Makefile +28 -0
- 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 +46 -0
- data/lib/erlang/messenger/src/pm_master.erl +5 -0
- data/lib/erlang/messenger/src/pm_node.erl +2 -3
- data/lib/erlang/messenger/src/pm_spawner.erl +213 -0
- data/lib/poolparty/base_packages/heartbeat.rb +57 -43
- data/lib/poolparty/base_packages/poolparty.rb +18 -15
- data/lib/poolparty/capistrano.rb +18 -0
- data/lib/poolparty/core/class.rb +24 -0
- data/lib/poolparty/core/kernel.rb +7 -0
- data/lib/poolparty/core/module.rb +2 -2
- data/lib/poolparty/core/string.rb +1 -1
- data/lib/poolparty/dependency_resolutions/puppet.rb +10 -2
- data/lib/poolparty/exceptions/ProvisionerException.rb +5 -0
- data/lib/poolparty/extra/deployments.rb +31 -0
- data/lib/poolparty/helpers/binary.rb +14 -2
- data/lib/poolparty/helpers/optioner.rb +61 -22
- data/lib/poolparty/helpers/ruberl.rb +33 -0
- data/lib/poolparty/modules/cloud_dsl.rb +2 -1
- data/lib/poolparty/modules/cloud_resourcer.rb +30 -6
- data/lib/poolparty/modules/configurable.rb +2 -0
- data/lib/poolparty/modules/file_writer.rb +4 -4
- data/lib/poolparty/modules/resourcing_dsl.rb +5 -5
- data/lib/poolparty/monitors/base_monitor.rb +1 -1
- data/lib/poolparty/monitors/monitors/cpu_monitor.rb +2 -2
- data/lib/poolparty/net/messenger.rb +1 -1
- data/lib/poolparty/net/remote.rb +2 -2
- data/lib/poolparty/net/remote_bases/ec2.rb +51 -11
- data/lib/poolparty/net/remote_instance.rb +7 -3
- data/lib/poolparty/net/remoter.rb +72 -24
- data/lib/poolparty/net/remoter_base.rb +10 -0
- data/lib/poolparty/plugins/deploydirectory.rb +10 -5
- data/lib/poolparty/plugins/git.rb +51 -0
- data/lib/poolparty/{pool → poolparty}/base.rb +4 -2
- data/lib/poolparty/{pool → poolparty}/cloud.rb +32 -10
- data/lib/poolparty/{pool → poolparty}/plugin_model.rb +4 -4
- data/lib/poolparty/{pool → poolparty}/pool.rb +2 -2
- data/lib/poolparty/{pool → poolparty}/resource.rb +33 -15
- data/lib/poolparty/{pool → poolparty}/resources/class_package.rb +3 -3
- data/lib/poolparty/{pool → poolparty}/resources/directory.rb +6 -3
- data/lib/poolparty/{pool → poolparty}/resources/exec.rb +2 -5
- data/lib/poolparty/{pool → poolparty}/resources/file.rb +3 -3
- data/lib/poolparty/{pool → poolparty}/resources/package.rb +1 -1
- data/lib/poolparty/{pool → poolparty}/resources/remote_file.rb +1 -1
- data/lib/poolparty/poolparty/resources/remote_user.rb +17 -0
- data/lib/poolparty/{pool → poolparty}/resources/sshkey.rb +5 -1
- data/lib/poolparty/{pool → poolparty}/script.rb +1 -1
- data/lib/poolparty/provisioners/capistrano/capistrano.rb +127 -0
- data/lib/poolparty/provisioners/capistrano/capistrano_configurer.rb +58 -0
- data/lib/poolparty/provisioners/capistrano/recipies/base.rb +104 -0
- data/lib/poolparty/provisioners/capistrano/recipies/master.rb +121 -0
- data/lib/poolparty/provisioners/capistrano/recipies/slave.rb +12 -0
- data/lib/poolparty/provisioners/provisioner_base.rb +204 -0
- data/lib/poolparty/spec/core/string.rb +16 -0
- data/lib/poolparty/spec/matchers/a_spec_extensions_base.rb +26 -0
- data/lib/poolparty/spec/matchers/have_cron.rb +28 -0
- data/lib/poolparty/spec/matchers/have_deploydirectory.rb +15 -0
- data/lib/poolparty/spec/matchers/have_directory.rb +31 -0
- data/lib/poolparty/spec/matchers/have_exec.rb +28 -0
- data/lib/poolparty/spec/matchers/have_file.rb +28 -0
- data/lib/poolparty/spec/matchers/have_gempackage.rb +28 -0
- data/lib/poolparty/spec/matchers/have_git.rb +28 -0
- data/lib/poolparty/spec/matchers/have_host.rb +28 -0
- data/lib/poolparty/spec/matchers/have_mount.rb +28 -0
- data/lib/poolparty/spec/matchers/have_package.rb +28 -0
- data/lib/poolparty/spec/matchers/have_remotefile.rb +28 -0
- data/lib/poolparty/spec/matchers/have_rsyncmirror.rb +28 -0
- data/lib/poolparty/spec/matchers/have_service.rb +28 -0
- data/lib/poolparty/spec/matchers/have_sshkey.rb +28 -0
- data/lib/poolparty/spec/matchers/have_symlink.rb +28 -0
- data/lib/poolparty/spec/matchers/have_variable.rb +32 -0
- data/lib/poolparty/spec/spec/dynamic_matchers.rb +63 -0
- data/lib/poolparty/spec/spec/ensure_matchers_exist.rb +7 -0
- data/lib/poolparty/spec/templates/have_base.rb +28 -0
- data/lib/poolparty/templates/authkeys +1 -1
- data/lib/poolparty/templates/gem +12 -10
- data/lib/poolparty/templates/ha.cf +9 -11
- data/lib/poolparty/templates/haresources +1 -1
- data/lib/poolparty/templates/logd.cf +42 -0
- data/lib/poolparty/templates/puppet.conf +18 -8
- data/lib/poolparty/templates/puppetcleaner +9 -3
- data/lib/poolparty/templates/puppetrerun +16 -3
- data/lib/poolparty/templates/puppetrunner +1 -1
- data/lib/poolparty/version.rb +1 -1
- data/lib/poolparty.rb +12 -8
- data/lib/poolpartyspec.rb +34 -0
- data/poolparty.gemspec +151 -149
- data/spec/poolparty/aska/aska_spec.rb +0 -5
- data/spec/poolparty/bin/console_spec.rb +3 -0
- data/spec/poolparty/extra/deployments_spec.rb +64 -0
- data/spec/poolparty/helpers/binary_spec.rb +1 -1
- data/spec/poolparty/helpers/optioner_spec.rb +17 -4
- data/spec/poolparty/modules/cloud_resourcer_spec.rb +19 -2
- data/spec/poolparty/modules/configurable_spec.rb +2 -2
- data/spec/poolparty/net/remote_bases/ec2_spec.rb +5 -2
- data/spec/poolparty/net/remote_instance_spec.rb +5 -0
- data/spec/poolparty/net/remote_spec.rb +24 -31
- data/spec/poolparty/net/remoter_base_spec.rb +11 -6
- data/spec/poolparty/net/remoter_spec.rb +55 -27
- data/spec/poolparty/plugins/deploydirectory_spec.rb +1 -0
- data/spec/poolparty/plugins/git_spec.rb +45 -0
- data/spec/poolparty/{pool → poolparty}/cloud_spec.rb +41 -0
- data/spec/poolparty/{pool → poolparty}/plugin_spec.rb +1 -1
- data/spec/poolparty/{pool → poolparty}/pool_spec.rb +1 -1
- data/spec/poolparty/{pool → poolparty}/resource_spec.rb +15 -2
- data/spec/poolparty/poolparty/resources/user_spec.rb +38 -0
- data/spec/poolparty/poolparty/test_plugins/virtual_host_template.erb +0 -0
- data/spec/poolparty/poolparty_spec.rb +1 -1
- data/spec/poolparty/provisioners/capistrano/capistrano_spec.rb +27 -0
- data/spec/poolparty/provisioners/provisioner_base_spec.rb +120 -0
- data/spec/poolparty/spec/core/string_spec.rb +57 -0
- data/spec/poolparty/spec_helper.rb +48 -6
- data/tasks/deployment.rake +3 -5
- data/tasks/spec.rake +2 -3
- data/website/index.html +2 -2
- metadata +150 -148
- data/lib/erlang/messenger/lib/eunit/.svn/all-wcprops +0 -53
- data/lib/erlang/messenger/lib/eunit/.svn/entries +0 -140
- data/lib/erlang/messenger/lib/eunit/.svn/format +0 -1
- data/lib/erlang/messenger/lib/eunit/.svn/prop-base/NOTES.svn-base +0 -5
- data/lib/erlang/messenger/lib/eunit/.svn/text-base/AUTHORS.svn-base +0 -2
- data/lib/erlang/messenger/lib/eunit/.svn/text-base/CHANGELOG.svn-base +0 -14
- data/lib/erlang/messenger/lib/eunit/.svn/text-base/COPYING.svn-base +0 -504
- data/lib/erlang/messenger/lib/eunit/.svn/text-base/NOTES.svn-base +0 -276
- data/lib/erlang/messenger/lib/eunit/.svn/text-base/README.svn-base +0 -3
- data/lib/erlang/messenger/lib/eunit/.svn/text-base/sys.config.svn-base +0 -9
- data/lib/erlang/messenger/lib/eunit/.svn/text-base/vsn.mk.svn-base +0 -1
- data/lib/erlang/messenger/lib/eunit/doc/.svn/all-wcprops +0 -59
- data/lib/erlang/messenger/lib/eunit/doc/.svn/entries +0 -142
- data/lib/erlang/messenger/lib/eunit/doc/.svn/format +0 -1
- data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/erlang.png.svn-base +0 -5
- data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/eunit.html.svn-base +0 -5
- data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/index.html.svn-base +0 -5
- data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/modules-frame.html.svn-base +0 -5
- data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/overview-summary.html.svn-base +0 -5
- data/lib/erlang/messenger/lib/eunit/doc/.svn/prop-base/packages-frame.html.svn-base +0 -5
- data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/edoc-info.svn-base +0 -3
- 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 +0 -172
- data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/index.html.svn-base +0 -17
- data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/modules-frame.html.svn-base +0 -12
- data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/overview-summary.html.svn-base +0 -984
- data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/overview.edoc.svn-base +0 -980
- data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/packages-frame.html.svn-base +0 -11
- data/lib/erlang/messenger/lib/eunit/doc/.svn/text-base/stylesheet.css.svn-base +0 -55
- data/lib/erlang/messenger/lib/eunit/ebin/.svn/all-wcprops +0 -5
- data/lib/erlang/messenger/lib/eunit/ebin/.svn/dir-prop-base +0 -8
- data/lib/erlang/messenger/lib/eunit/ebin/.svn/entries +0 -28
- data/lib/erlang/messenger/lib/eunit/ebin/.svn/format +0 -1
- data/lib/erlang/messenger/lib/eunit/examples/.svn/all-wcprops +0 -23
- data/lib/erlang/messenger/lib/eunit/examples/.svn/entries +0 -66
- data/lib/erlang/messenger/lib/eunit/examples/.svn/format +0 -1
- data/lib/erlang/messenger/lib/eunit/examples/.svn/prop-base/eunit_examples.erl.svn-base +0 -5
- data/lib/erlang/messenger/lib/eunit/examples/.svn/prop-base/fib.erl.svn-base +0 -5
- data/lib/erlang/messenger/lib/eunit/examples/.svn/text-base/eunit_examples.erl.svn-base +0 -339
- data/lib/erlang/messenger/lib/eunit/examples/.svn/text-base/fib.erl.svn-base +0 -19
- data/lib/erlang/messenger/lib/eunit/examples/.svn/text-base/tests.txt.svn-base +0 -1
- data/lib/erlang/messenger/lib/eunit/include/.svn/all-wcprops +0 -11
- data/lib/erlang/messenger/lib/eunit/include/.svn/entries +0 -41
- data/lib/erlang/messenger/lib/eunit/include/.svn/format +0 -1
- data/lib/erlang/messenger/lib/eunit/include/.svn/prop-base/eunit.hrl.svn-base +0 -5
- data/lib/erlang/messenger/lib/eunit/include/.svn/text-base/eunit.hrl.svn-base +0 -313
- data/lib/erlang/messenger/lib/eunit/src/.svn/all-wcprops +0 -113
- data/lib/erlang/messenger/lib/eunit/src/.svn/entries +0 -259
- data/lib/erlang/messenger/lib/eunit/src/.svn/format +0 -1
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/autoload.erl.svn-base +0 -5
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/code_monitor.erl.svn-base +0 -5
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit.erl.svn-base +0 -5
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_autoexport.erl.svn-base +0 -5
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_data.erl.svn-base +0 -5
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_internal.hrl.svn-base +0 -5
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_lib.erl.svn-base +0 -5
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_proc.erl.svn-base +0 -5
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_serial.erl.svn-base +0 -5
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_server.erl.svn-base +0 -5
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_striptests.erl.svn-base +0 -5
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_test.erl.svn-base +0 -5
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_tests.erl.svn-base +0 -5
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/eunit_tty.erl.svn-base +0 -5
- data/lib/erlang/messenger/lib/eunit/src/.svn/prop-base/file_monitor.erl.svn-base +0 -5
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/autoload.erl.svn-base +0 -388
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/code_monitor.erl.svn-base +0 -243
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit.app.src.svn-base +0 -21
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit.appup.src.svn-base +0 -1
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit.erl.svn-base +0 -196
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_autoexport.erl.svn-base +0 -102
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_data.erl.svn-base +0 -798
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_internal.hrl.svn-base +0 -48
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_lib.erl.svn-base +0 -682
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_proc.erl.svn-base +0 -552
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_serial.erl.svn-base +0 -157
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_server.erl.svn-base +0 -340
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_striptests.erl.svn-base +0 -64
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_test.erl.svn-base +0 -334
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_tests.erl.svn-base +0 -45
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/eunit_tty.erl.svn-base +0 -272
- data/lib/erlang/messenger/lib/eunit/src/.svn/text-base/file_monitor.erl.svn-base +0 -409
- data/lib/erlang/messenger/src/pm_client_old.erl +0 -52
- data/lib/poolparty/helpers/provisioner_base.rb +0 -346
- data/lib/poolparty/helpers/provisioners/master.rb +0 -205
- data/lib/poolparty/helpers/provisioners/slave.rb +0 -64
- data/spec/poolparty/helpers/provisioner_base_spec.rb +0 -134
- data/spec/poolparty/helpers/provisioners/master_spec.rb +0 -54
- data/spec/poolparty/helpers/provisioners/slave_spec.rb +0 -28
- /data/lib/poolparty/{pool → poolparty}/custom_resource.rb +0 -0
- /data/lib/poolparty/{pool → poolparty}/loggable.rb +0 -0
- /data/lib/poolparty/{pool → poolparty}/plugin.rb +0 -0
- /data/lib/poolparty/{pool → poolparty}/resources/conditional.rb +0 -0
- /data/lib/poolparty/{pool → poolparty}/resources/cron.rb +0 -0
- /data/lib/poolparty/{pool → poolparty}/resources/custom_service.rb +0 -0
- /data/lib/poolparty/{pool → poolparty}/resources/gem_package.rb +0 -0
- /data/lib/poolparty/{pool → poolparty}/resources/host.rb +0 -0
- /data/lib/poolparty/{pool → poolparty}/resources/mount.rb +0 -0
- /data/lib/poolparty/{pool → poolparty}/resources/service.rb +0 -0
- /data/lib/poolparty/{pool → poolparty}/resources/symlink.rb +0 -0
- /data/lib/poolparty/{pool → poolparty}/resources/variable.rb +0 -0
- /data/log/{pool.logs → pool.log} +0 -0
- /data/spec/poolparty/{pool/test_plugins/virtual_host_template.erb → net/log/pool.log} +0 -0
- /data/spec/poolparty/{pool → poolparty}/base_spec.rb +0 -0
- /data/spec/poolparty/{pool → poolparty}/configurers/files/ruby_basic.rb +0 -0
- /data/spec/poolparty/{pool → poolparty}/configurers/files/ruby_plugins.rb +0 -0
- /data/spec/poolparty/{pool → poolparty}/configurers/ruby_spec.rb +0 -0
- /data/spec/poolparty/{pool → poolparty}/custom_resource_spec.rb +0 -0
- /data/spec/poolparty/{pool → poolparty}/example_spec.rb +0 -0
- /data/spec/poolparty/{pool → poolparty}/plugin_model_spec.rb +0 -0
- /data/spec/poolparty/{pool → poolparty}/resources/class_package_spec.rb +0 -0
- /data/spec/poolparty/{pool → poolparty}/resources/conditional_spec.rb +0 -0
- /data/spec/poolparty/{pool → poolparty}/resources/cron_spec.rb +0 -0
- /data/spec/poolparty/{pool → poolparty}/resources/directory_spec.rb +0 -0
- /data/spec/poolparty/{pool → poolparty}/resources/exec_spec.rb +0 -0
- /data/spec/poolparty/{pool → poolparty}/resources/file_spec.rb +0 -0
- /data/spec/poolparty/{pool → poolparty}/resources/gem_spec.rb +0 -0
- /data/spec/poolparty/{pool → poolparty}/resources/host_spec.rb +0 -0
- /data/spec/poolparty/{pool → poolparty}/resources/package_spec.rb +0 -0
- /data/spec/poolparty/{pool → poolparty}/resources/remote_file_spec.rb +0 -0
- /data/spec/poolparty/{pool → poolparty}/resources/service_spec.rb +0 -0
- /data/spec/poolparty/{pool → poolparty}/resources/sshkey_spec.rb +0 -0
- /data/spec/poolparty/{pool → poolparty}/resources/symlink_spec.rb +0 -0
- /data/spec/poolparty/{pool → poolparty}/resources/variable_spec.rb +0 -0
- /data/spec/poolparty/{pool → poolparty}/script_spec.rb +0 -0
- /data/spec/poolparty/{pool → poolparty}/test_plugins/sshkey_test +0 -0
- /data/spec/poolparty/{pool → poolparty}/test_plugins/webserver.rb +0 -0
@@ -1,409 +0,0 @@
|
|
1
|
-
%% This library is free software; you can redistribute it and/or modify
|
2
|
-
%% it under the terms of the GNU Lesser General Public License as
|
3
|
-
%% published by the Free Software Foundation; either version 2 of the
|
4
|
-
%% License, or (at your option) any later version.
|
5
|
-
%%
|
6
|
-
%% This library is distributed in the hope that it will be useful, but
|
7
|
-
%% WITHOUT ANY WARRANTY; without even the implied warranty of
|
8
|
-
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
9
|
-
%% Lesser General Public License for more details.
|
10
|
-
%%
|
11
|
-
%% You should have received a copy of the GNU Lesser General Public
|
12
|
-
%% License along with this library; if not, write to the Free Software
|
13
|
-
%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
14
|
-
%% USA
|
15
|
-
%%
|
16
|
-
%% $Id$
|
17
|
-
%%
|
18
|
-
%% @private (for now)
|
19
|
-
%% @author Richard Carlsson <richardc@it.uu.se>
|
20
|
-
%% @copyright 2006 Richard Carlsson
|
21
|
-
%% @doc Erlang file monitoring service
|
22
|
-
|
23
|
-
%% The behaviour of this service is inspired by the open source FAM
|
24
|
-
%% daemon [http://oss.sgi.com/projects/fam/].
|
25
|
-
|
26
|
-
-module(file_monitor).
|
27
|
-
|
28
|
-
-export([start/0, start/1, start/2, stop/0, stop/1, monitor_file/2,
|
29
|
-
monitor_file/3, monitor_dir/2, monitor_dir/3, demonitor/1,
|
30
|
-
demonitor/2]).
|
31
|
-
|
32
|
-
-export([main/1]). %% private
|
33
|
-
|
34
|
-
-include_lib("kernel/include/file.hrl").
|
35
|
-
|
36
|
-
-define(POLL_TIME, 5000). % default; change with option poll_time
|
37
|
-
-define(SERVER, file_monitor).
|
38
|
-
|
39
|
-
%% NOTE: paths should be absolute, but this is not checked
|
40
|
-
|
41
|
-
%% We don't change the paths, e.g. from relative to absolute, but we
|
42
|
-
%% make sure that the path is a flat string and return it to the caller.
|
43
|
-
|
44
|
-
monitor_file(Path, Pid) ->
|
45
|
-
monitor_file(?SERVER, Path, Pid).
|
46
|
-
|
47
|
-
monitor_file(Server, Path, Pid) ->
|
48
|
-
monitor(Server, file, filename:flatten(Path), Pid).
|
49
|
-
|
50
|
-
monitor_dir(Path, Pid) ->
|
51
|
-
monitor_dir(?SERVER, Path, Pid).
|
52
|
-
|
53
|
-
monitor_dir(Server, Path, Pid) ->
|
54
|
-
monitor(Server, dir, filename:flatten(Path), Pid).
|
55
|
-
|
56
|
-
monitor(Server, Type, Path, Pid) when is_pid(Pid) ->
|
57
|
-
{ok, Ref} = command(Server, {monitor, {Type, Path}, Pid}),
|
58
|
-
{ok, Path, Ref}.
|
59
|
-
|
60
|
-
demonitor(Ref) ->
|
61
|
-
demonitor(?SERVER, Ref).
|
62
|
-
|
63
|
-
demonitor(Server, Ref) ->
|
64
|
-
ok = command(Server, {demonitor, Ref}).
|
65
|
-
|
66
|
-
|
67
|
-
command(Server, Cmd) ->
|
68
|
-
ServerPid = ensure_started(Server),
|
69
|
-
ServerPid ! {command, self(), Cmd},
|
70
|
-
receive
|
71
|
-
{ServerPid, Result} -> Result
|
72
|
-
end.
|
73
|
-
|
74
|
-
|
75
|
-
stop() ->
|
76
|
-
stop(?SERVER).
|
77
|
-
|
78
|
-
stop(Server) ->
|
79
|
-
Server ! stop,
|
80
|
-
ok.
|
81
|
-
|
82
|
-
ensure_started(Name) when is_atom(Name) ->
|
83
|
-
start(Name, []);
|
84
|
-
ensure_started(Pid) when is_pid(Pid) ->
|
85
|
-
Pid.
|
86
|
-
|
87
|
-
start() ->
|
88
|
-
start([]).
|
89
|
-
|
90
|
-
start(Options) ->
|
91
|
-
start(?SERVER, Options).
|
92
|
-
|
93
|
-
start(Name, Options) ->
|
94
|
-
case whereis(Name) of
|
95
|
-
undefined ->
|
96
|
-
Parent = self(),
|
97
|
-
Pid = spawn(fun () -> server_init(Name, Parent, Options) end),
|
98
|
-
receive
|
99
|
-
{Pid, ok} -> Pid;
|
100
|
-
{Pid, error} -> throw(no_server)
|
101
|
-
end;
|
102
|
-
Pid -> Pid
|
103
|
-
end.
|
104
|
-
|
105
|
-
-record(state, {name, time, dirs, files, clients, refs}).
|
106
|
-
|
107
|
-
server_init(undefined = Name, Parent, Options) ->
|
108
|
-
%% anonymous server
|
109
|
-
server_init_1(Name, Parent, Options);
|
110
|
-
server_init(Name, Parent, Options) ->
|
111
|
-
case catch register(Name, self()) of
|
112
|
-
true ->
|
113
|
-
server_init_1(Name, Parent, Options);
|
114
|
-
_ ->
|
115
|
-
Parent ! {self(), error},
|
116
|
-
exit(failed)
|
117
|
-
end.
|
118
|
-
|
119
|
-
server_init_1(Name, Parent, Options) ->
|
120
|
-
Parent ! {self(), ok},
|
121
|
-
server(set_timer(init_state(Name, Options))).
|
122
|
-
|
123
|
-
init_state(Name, Options) ->
|
124
|
-
Time = case proplists:get_value(poll_time, Options) of
|
125
|
-
N when is_integer(N), N >= 100 -> N;
|
126
|
-
_ -> ?POLL_TIME
|
127
|
-
end,
|
128
|
-
#state{name = Name,
|
129
|
-
time = Time,
|
130
|
-
dirs = dict:new(),
|
131
|
-
files = dict:new(),
|
132
|
-
clients = dict:new(),
|
133
|
-
refs = dict:new()}.
|
134
|
-
|
135
|
-
server(St) -> ?MODULE:main(St).
|
136
|
-
|
137
|
-
%% @private
|
138
|
-
main(St) ->
|
139
|
-
receive
|
140
|
-
{command, From, {monitor, Object, Pid}} when is_pid(Pid) ->
|
141
|
-
{Ref, St1} = new_monitor(Object, Pid, St),
|
142
|
-
server_reply(From, {ok, Ref}),
|
143
|
-
server(add_client(Pid, St1));
|
144
|
-
{command, From, {demonitor, Ref}} ->
|
145
|
-
server_reply(From, ok),
|
146
|
-
server(delete_monitor(Ref, St));
|
147
|
-
stop ->
|
148
|
-
exit(normal);
|
149
|
-
time ->
|
150
|
-
server(set_timer(poll(St)));
|
151
|
-
{'DOWN', _Ref, process, Pid, _Info} ->
|
152
|
-
server(purge_pid(Pid, del_client(Pid, St)));
|
153
|
-
_ ->
|
154
|
-
server(St)
|
155
|
-
end.
|
156
|
-
|
157
|
-
server_reply(To, Msg) ->
|
158
|
-
To ! {self(), Msg}.
|
159
|
-
|
160
|
-
set_timer(St) ->
|
161
|
-
erlang:send_after(St#state.time, self(), time),
|
162
|
-
St.
|
163
|
-
|
164
|
-
|
165
|
-
%% client monitoring (once a client, always a client - until death)
|
166
|
-
|
167
|
-
add_client(Pid, St) ->
|
168
|
-
case dict:is_key(Pid, St#state.clients) of
|
169
|
-
true ->
|
170
|
-
St;
|
171
|
-
false ->
|
172
|
-
Ref = erlang:monitor(process, Pid),
|
173
|
-
St#state{clients = dict:store(Pid, Ref, St#state.clients)}
|
174
|
-
end.
|
175
|
-
|
176
|
-
del_client(Pid, St) ->
|
177
|
-
case dict:find(Pid, St#state.clients) of
|
178
|
-
{ok, Ref} ->
|
179
|
-
erlang:demonitor(Ref, [flush]),
|
180
|
-
St#state{clients = dict:erase(Pid, St#state.clients)};
|
181
|
-
error ->
|
182
|
-
St
|
183
|
-
end.
|
184
|
-
|
185
|
-
|
186
|
-
-record(monitor, {pid, reference}).
|
187
|
-
|
188
|
-
-record(entry, {info = undefined, files = [], monitors = sets:new()}).
|
189
|
-
|
190
|
-
new_monitor(Object, Pid, St) ->
|
191
|
-
Ref = make_ref(),
|
192
|
-
Monitor = #monitor{pid = Pid, reference = Ref},
|
193
|
-
new_monitor(Object, Monitor, Ref,
|
194
|
-
St#state{refs = dict:store(Ref, {Pid, Object},
|
195
|
-
St#state.refs)}).
|
196
|
-
|
197
|
-
%% We must separate the namespaces for files and dirs, since we can't
|
198
|
-
%% trust the users to keep them distinct; there may be simultaneous file
|
199
|
-
%% and dir monitors for the same path.
|
200
|
-
|
201
|
-
new_monitor({file, Path}, Monitor, Ref, St) ->
|
202
|
-
{Ref, St#state{files = add_monitor(Path, Monitor, file,
|
203
|
-
St#state.files)}};
|
204
|
-
new_monitor({dir, Path}, Monitor, Ref, St) ->
|
205
|
-
{Ref, St#state{dirs = add_monitor(Path, Monitor, dir,
|
206
|
-
St#state.dirs)}}.
|
207
|
-
|
208
|
-
%% Adding a new monitor forces an immediate poll of the file, such that
|
209
|
-
%% previous monitors only see any real change, while the new monitor
|
210
|
-
%% either gets {exists, ...} or {error, ...}.
|
211
|
-
|
212
|
-
add_monitor(Path, Monitor, Type, Dict) ->
|
213
|
-
Entry = case dict:find(Path, Dict) of
|
214
|
-
{ok, OldEntry} -> poll_file(Path, OldEntry, Type);
|
215
|
-
error -> new_entry(Path, Type)
|
216
|
-
end,
|
217
|
-
event(#entry{}, dummy_entry(Entry, Monitor), Type, Path),
|
218
|
-
NewEntry = Entry#entry{monitors =
|
219
|
-
sets:add_element(Monitor,
|
220
|
-
Entry#entry.monitors)},
|
221
|
-
dict:store(Path, NewEntry, Dict).
|
222
|
-
|
223
|
-
dummy_entry(Entry, Monitor) ->
|
224
|
-
Entry#entry{monitors = sets:add_element(Monitor, sets:new())}.
|
225
|
-
|
226
|
-
new_entry(Path, Type) ->
|
227
|
-
refresh_entry(Path, #entry{monitors = sets:new()}, Type).
|
228
|
-
|
229
|
-
%% deleting a monitor by reference
|
230
|
-
|
231
|
-
delete_monitor(Ref, St) ->
|
232
|
-
case dict:find(Ref, St#state.refs) of
|
233
|
-
{ok, {_Pid, Object}} ->
|
234
|
-
St1 = St#state{refs = dict:erase(Ref, St#state.refs)},
|
235
|
-
delete_monitor_1(Ref, Object, St1);
|
236
|
-
error ->
|
237
|
-
St
|
238
|
-
end.
|
239
|
-
|
240
|
-
delete_monitor_1(Ref, {file, Path}, St) ->
|
241
|
-
St#state{files = delete_monitor_2(Path, Ref, St#state.files)};
|
242
|
-
delete_monitor_1(Ref, {dir, Path}, St) ->
|
243
|
-
St#state{dirs = delete_monitor_2(Path, Ref, St#state.dirs)}.
|
244
|
-
|
245
|
-
delete_monitor_2(Path, Ref, Dict) ->
|
246
|
-
case dict:find(Path, Dict) of
|
247
|
-
{ok, Entry} ->
|
248
|
-
purge_empty_sets(
|
249
|
-
dict:store(Path, purge_monitor_ref(Ref, Entry), Dict));
|
250
|
-
error ->
|
251
|
-
Dict
|
252
|
-
end.
|
253
|
-
|
254
|
-
purge_monitor_ref(Ref, Entry) ->
|
255
|
-
Entry#entry{monitors =
|
256
|
-
sets:filter(fun (#monitor{reference = R})
|
257
|
-
when R == Ref -> false;
|
258
|
-
(_) -> true
|
259
|
-
end,
|
260
|
-
Entry#entry.monitors)}.
|
261
|
-
|
262
|
-
%% purging monitors belonging to dead clients
|
263
|
-
|
264
|
-
purge_pid(Pid, St) ->
|
265
|
-
Files = dict:map(fun (_Path, Entry) ->
|
266
|
-
purge_monitor_pid(Pid, Entry)
|
267
|
-
end,
|
268
|
-
St#state.files),
|
269
|
-
Dirs = dict:map(fun (_Path, Entry) ->
|
270
|
-
purge_monitor_pid(Pid, Entry)
|
271
|
-
end,
|
272
|
-
St#state.dirs),
|
273
|
-
Refs = dict:filter(fun (_Ref, {P, _})
|
274
|
-
when P == Pid -> false;
|
275
|
-
(_, _) -> true
|
276
|
-
end,
|
277
|
-
St#state.refs),
|
278
|
-
St#state{refs = Refs,
|
279
|
-
files = purge_empty_sets(Files),
|
280
|
-
dirs = purge_empty_sets(Dirs)}.
|
281
|
-
|
282
|
-
purge_monitor_pid(Pid, Entry) ->
|
283
|
-
Entry#entry{monitors =
|
284
|
-
sets:filter(fun (#monitor{pid = P})
|
285
|
-
when P == Pid -> false;
|
286
|
-
(_) -> true
|
287
|
-
end,
|
288
|
-
Entry#entry.monitors)}.
|
289
|
-
|
290
|
-
purge_empty_sets(Dict) ->
|
291
|
-
dict:filter(fun (_Path, Entry) ->
|
292
|
-
sets:size(Entry#entry.monitors) > 0
|
293
|
-
end, Dict).
|
294
|
-
|
295
|
-
|
296
|
-
%% generating events upon state changes
|
297
|
-
|
298
|
-
%% Message formats:
|
299
|
-
%% {exists, Path, Type, #file_info{}, Files}
|
300
|
-
%% {changed, Path, Type, #file_info{}, Files}
|
301
|
-
%% {error, Path, Type, Info}
|
302
|
-
%%
|
303
|
-
%% Type is dir or file. If Type is file, Files is always []. If Type is
|
304
|
-
%% dir, Files is a list of {added, FileName} and {deleted, FileName},
|
305
|
-
%% where FileName is relative to dir, without any path component.
|
306
|
-
%%
|
307
|
-
%% When a new monitor is installed for a path, an initial {exists,...}
|
308
|
-
%% or {error,...} message will be sent to the monitor owner.
|
309
|
-
%%
|
310
|
-
%% Subsequent events will be either {changed,...} or {error,...}.
|
311
|
-
|
312
|
-
event(#entry{info = Info}, #entry{info = Info}, _Type, _Path) ->
|
313
|
-
%% no change in state
|
314
|
-
ok;
|
315
|
-
event(#entry{info = undefined}, #entry{info = NewInfo}=Entry,
|
316
|
-
Type, Path)
|
317
|
-
when not is_atom(NewInfo) ->
|
318
|
-
%% file or directory exists, for a fresh monitor
|
319
|
-
Files = [{added, F} || F <- Entry#entry.files],
|
320
|
-
cast({exists, Path, Type, NewInfo, Files}, Entry#entry.monitors);
|
321
|
-
event(_OldEntry, #entry{info = NewInfo}=Entry, Type, Path)
|
322
|
-
when is_atom(NewInfo) ->
|
323
|
-
%% file is not available
|
324
|
-
cast({error, Path, Type, NewInfo}, Entry#entry.monitors);
|
325
|
-
event(_OldEntry, Entry, file, Path) ->
|
326
|
-
%% a normal file has changed
|
327
|
-
cast({changed, Path, file, Entry#entry.info, []},
|
328
|
-
Entry#entry.monitors);
|
329
|
-
event(#entry{info = OldInfo}, #entry{info = NewInfo}=Entry, dir, Path)
|
330
|
-
when is_atom(OldInfo) ->
|
331
|
-
%% a directory has suddenly become available
|
332
|
-
Files = [{added, F} || F <- Entry#entry.files],
|
333
|
-
cast({changed, Path, dir, NewInfo, Files}, Entry#entry.monitors);
|
334
|
-
event(OldEntry, #entry{info = NewInfo}=Entry, dir, Path) ->
|
335
|
-
%% a directory has changed
|
336
|
-
Files = diff_lists(Entry#entry.files, OldEntry#entry.files),
|
337
|
-
cast({changed, Path, dir, NewInfo, Files}, Entry#entry.monitors).
|
338
|
-
|
339
|
-
|
340
|
-
poll(St) ->
|
341
|
-
St#state{files = dict:map(fun (Path, Entry) ->
|
342
|
-
poll_file(Path, Entry, file)
|
343
|
-
end,
|
344
|
-
St#state.files),
|
345
|
-
dirs = dict:map(fun (Path, Entry) ->
|
346
|
-
poll_file(Path, Entry, dir)
|
347
|
-
end,
|
348
|
-
St#state.dirs)}.
|
349
|
-
|
350
|
-
poll_file(Path, Entry, Type) ->
|
351
|
-
NewEntry = refresh_entry(Path, Entry, Type),
|
352
|
-
event(Entry, NewEntry, Type, Path),
|
353
|
-
NewEntry.
|
354
|
-
|
355
|
-
refresh_entry(Path, Entry, Type) ->
|
356
|
-
Info = get_file_info(Path),
|
357
|
-
Files = case Type of
|
358
|
-
dir when not is_atom(Info) -> get_dir_files(Path);
|
359
|
-
_ -> []
|
360
|
-
end,
|
361
|
-
Entry#entry{info = Info, files = Files}.
|
362
|
-
|
363
|
-
|
364
|
-
%% We clear some fields of the file_info so that we only trigger on real
|
365
|
-
%% changes; see the //kernel/file.erl manual and file.hrl for details.
|
366
|
-
|
367
|
-
get_file_info(Path) ->
|
368
|
-
case file:read_file_info(Path) of
|
369
|
-
{ok, Info} ->
|
370
|
-
Info#file_info{access = undefined,
|
371
|
-
atime = undefined};
|
372
|
-
{error, Error} ->
|
373
|
-
Error % posix error code as atom
|
374
|
-
end.
|
375
|
-
|
376
|
-
%% Listing the members of a directory; note that it yields the empty
|
377
|
-
%% list if it fails - this is not the place for error detection.
|
378
|
-
|
379
|
-
get_dir_files(Path) ->
|
380
|
-
case file:list_dir(Path) of
|
381
|
-
{ok, Files} -> lists:sort(Files);
|
382
|
-
{error, _} -> []
|
383
|
-
end.
|
384
|
-
|
385
|
-
%% both lists must be sorted for this diff to work
|
386
|
-
|
387
|
-
diff_lists([F1 | Fs1], [F2 | _]=Fs2) when F1 < F2 ->
|
388
|
-
[{added, F1} | diff_lists(Fs1, Fs2)];
|
389
|
-
diff_lists([F1 | _]=Fs1, [F2 | Fs2]) when F1 > F2 ->
|
390
|
-
[{deleted, F2} | diff_lists(Fs1, Fs2)];
|
391
|
-
diff_lists([_ | Fs1], [_ | Fs2]) ->
|
392
|
-
diff_lists(Fs1, Fs2);
|
393
|
-
diff_lists([F | Fs1], Fs2) ->
|
394
|
-
[{added, F} | diff_lists(Fs1, Fs2)];
|
395
|
-
diff_lists(Fs1, [F | Fs2]) ->
|
396
|
-
[{deleted, F} | diff_lists(Fs1, Fs2)];
|
397
|
-
diff_lists([], []) ->
|
398
|
-
[].
|
399
|
-
|
400
|
-
|
401
|
-
%% Multicasting events to clients
|
402
|
-
|
403
|
-
cast(Msg, Monitors) ->
|
404
|
-
sets:fold(fun (#monitor{pid = Pid, reference = Ref}, Msg) ->
|
405
|
-
%%erlang:display({file_monitor, Ref, Msg}),
|
406
|
-
Pid ! {file_monitor, Ref, Msg},
|
407
|
-
Msg % note that this is a fold, not a map
|
408
|
-
end,
|
409
|
-
Msg, Monitors).
|
@@ -1,52 +0,0 @@
|
|
1
|
-
-module (pm_client_old).
|
2
|
-
-include_lib("../include/defines.hrl").
|
3
|
-
|
4
|
-
-export ([reconfigure_cloud/0, get_load/1, get_live_nodes/0, start/0]).
|
5
|
-
-export ([run_cmd/1, fire_cmd/1]).
|
6
|
-
-export ([provision_orphan_running_servers/0]).
|
7
|
-
-export ([shutdown/0]).
|
8
|
-
% Run commands on the running master process
|
9
|
-
% erl -pa ./ebin/ -run pm_client get_load cpu -run init stop -noshell
|
10
|
-
|
11
|
-
% Connect to the master
|
12
|
-
start() ->
|
13
|
-
pong = net_adm:ping(?MASTER_LOCATION),
|
14
|
-
global:sync().
|
15
|
-
% Send the command Cmd to the pm_master process
|
16
|
-
run_cmd(Cmd) ->
|
17
|
-
Out = pm_master:run_cmd(Cmd),
|
18
|
-
io:format("~p", [Out]),
|
19
|
-
Out.
|
20
|
-
fire_cmd(Cmd) ->
|
21
|
-
Out = pm_master:fire_cmd(Cmd),
|
22
|
-
io:format("~p", [Out]),
|
23
|
-
Out.
|
24
|
-
% Reconfigure the cloud
|
25
|
-
reconfigure_cloud() -> pm_master:reconfigure_cloud().
|
26
|
-
% Get the load on the cloud of type Type
|
27
|
-
get_load(Type) ->
|
28
|
-
start(),
|
29
|
-
Load = pm_master:get_load(Type),
|
30
|
-
io:format("~p", [Load]),
|
31
|
-
Load.
|
32
|
-
|
33
|
-
% Check to see if there are servers that are unprovisioned
|
34
|
-
% And if there are, log in to them and start their messenger
|
35
|
-
% sending the live code on the master to them
|
36
|
-
provision_orphan_running_servers() ->
|
37
|
-
Instances = pm_cluster:any_new_servers(),
|
38
|
-
case lists:flatlength(Instances) of
|
39
|
-
0 ->
|
40
|
-
ok;
|
41
|
-
_ ->
|
42
|
-
utils:distribute_modules_to([pm_node, pm_node_supervisor, pm_event_manager, node_app], Instances),
|
43
|
-
pm_cluster:slaves(Instances),
|
44
|
-
Instances
|
45
|
-
end.
|
46
|
-
|
47
|
-
% Get a list of the live nodes
|
48
|
-
get_live_nodes() -> pm_master:get_current_nodes().
|
49
|
-
% Terminate the cloud messenger
|
50
|
-
% This sends a shutdown to the whole cloud
|
51
|
-
shutdown() ->
|
52
|
-
pm_master:shutdown_cloud().
|