poolparty 0.2.6 → 0.2.18
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 +123 -4
- data/PostInstall.txt +2 -1
- data/bin/cloud +16 -7
- data/bin/cloud-provision +9 -5
- data/bin/cloud-run +19 -0
- data/bin/cloud-ssh +2 -7
- data/bin/cloud-start +2 -1
- data/bin/pool +3 -3
- data/bin/server-build-messenger +20 -0
- data/bin/server-fire-cmd +14 -0
- data/bin/server-get-load +29 -0
- data/bin/server-list-active +25 -0
- data/bin/server-list-responding +24 -0
- data/bin/server-rerun +24 -0
- data/bin/server-start-master +27 -0
- data/bin/server-start-node +33 -0
- data/config/requirements.rb +1 -1
- data/erl_crash.dump +8409 -0
- data/lib/erlang/messenger/Emakefile +1 -0
- data/lib/erlang/messenger/Makefile +15 -0
- data/lib/erlang/messenger/README +5 -0
- data/lib/erlang/messenger/Rakefile +60 -0
- data/lib/erlang/messenger/control +11 -0
- data/lib/erlang/messenger/ebin/master.app +19 -0
- data/lib/erlang/messenger/ebin/master_app.beam +0 -0
- data/lib/erlang/messenger/ebin/node.app +19 -0
- data/lib/erlang/messenger/ebin/node_app.beam +0 -0
- data/lib/erlang/messenger/ebin/packager.app +19 -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_rel-0.1.rel +1 -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_rel-0.1.rel +1 -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/AUTHORS +2 -0
- data/lib/erlang/messenger/lib/eunit/CHANGELOG +14 -0
- data/lib/erlang/messenger/lib/eunit/COPYING +504 -0
- data/lib/erlang/messenger/lib/eunit/Makefile +28 -0
- data/lib/erlang/messenger/lib/eunit/NOTES +276 -0
- data/lib/erlang/messenger/lib/eunit/README +3 -0
- data/lib/erlang/messenger/lib/eunit/doc/edoc-info +3 -0
- data/lib/erlang/messenger/lib/eunit/doc/erlang.png +0 -0
- data/lib/erlang/messenger/lib/eunit/doc/eunit.html +172 -0
- data/lib/erlang/messenger/lib/eunit/doc/index.html +17 -0
- data/lib/erlang/messenger/lib/eunit/doc/modules-frame.html +12 -0
- data/lib/erlang/messenger/lib/eunit/doc/overview-summary.html +984 -0
- data/lib/erlang/messenger/lib/eunit/doc/overview.edoc +980 -0
- data/lib/erlang/messenger/lib/eunit/doc/packages-frame.html +11 -0
- data/lib/erlang/messenger/lib/eunit/doc/stylesheet.css +55 -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.app +21 -0
- data/lib/erlang/messenger/lib/eunit/ebin/eunit.appup +1 -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/examples/eunit_examples.erl +339 -0
- data/lib/erlang/messenger/lib/eunit/examples/fib.erl +19 -0
- data/lib/erlang/messenger/lib/eunit/examples/tests.txt +1 -0
- data/lib/erlang/messenger/lib/eunit/include/eunit.hrl +313 -0
- data/lib/erlang/messenger/lib/eunit/src/Makefile +46 -0
- data/lib/erlang/messenger/lib/eunit/src/autoload.erl +388 -0
- data/lib/erlang/messenger/lib/eunit/src/code_monitor.erl +243 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit.app.src +21 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit.appup.src +1 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit.erl +196 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_autoexport.erl +102 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_data.erl +798 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_internal.hrl +48 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_lib.erl +682 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_proc.erl +552 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_serial.erl +157 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_server.erl +340 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_striptests.erl +64 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_test.erl +334 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_tests.erl +45 -0
- data/lib/erlang/messenger/lib/eunit/src/eunit_tty.erl +272 -0
- data/lib/erlang/messenger/lib/eunit/src/file_monitor.erl +409 -0
- data/lib/erlang/messenger/lib/eunit/sys.config +9 -0
- data/lib/erlang/messenger/lib/eunit/vsn.mk +1 -0
- data/lib/erlang/messenger/pm_master_rel-0.1.boot +0 -0
- data/lib/erlang/messenger/pm_master_rel-0.1.script +242 -0
- data/lib/erlang/messenger/pm_node_rel-0.1.boot +0 -0
- data/lib/erlang/messenger/pm_node_rel-0.1.script +242 -0
- data/lib/erlang/messenger/src/master_app.erl +39 -0
- data/lib/erlang/messenger/src/node_app.erl +39 -0
- data/lib/erlang/messenger/src/pm_client.erl +19 -0
- data/lib/erlang/messenger/src/pm_cluster.erl +57 -0
- data/lib/erlang/messenger/src/pm_event_handler.erl +21 -0
- data/lib/erlang/messenger/src/pm_master.erl +118 -0
- data/lib/erlang/messenger/src/pm_master_supervisor.erl +40 -0
- data/lib/erlang/messenger/src/pm_node.erl +124 -0
- data/lib/erlang/messenger/src/pm_node_supervisor.erl +40 -0
- data/lib/erlang/messenger/src/pm_packager.erl +73 -0
- data/lib/erlang/messenger/src/utils.erl +38 -0
- data/lib/poolparty/base_packages/haproxy.rb +9 -2
- data/lib/poolparty/base_packages/heartbeat.rb +40 -28
- data/lib/poolparty/base_packages/poolparty.rb +39 -16
- data/lib/poolparty/base_packages/ruby.rb +2 -3
- data/lib/poolparty/config/allowed_commands.yml +1 -0
- data/lib/poolparty/core/array.rb +5 -2
- data/lib/poolparty/core/hash.rb +16 -2
- data/lib/poolparty/core/string.rb +9 -2
- data/lib/poolparty/core/symbol.rb +2 -2
- data/lib/poolparty/dependency_resolutions/base.rb +12 -0
- data/lib/poolparty/dependency_resolutions/puppet.rb +49 -0
- data/lib/poolparty/exceptions/UnacceptableCommand.rb +5 -0
- data/lib/poolparty/helpers/console.rb +3 -2
- data/lib/poolparty/helpers/display.rb +3 -3
- data/lib/poolparty/helpers/messenger.rb +29 -0
- data/lib/poolparty/helpers/optioner.rb +6 -2
- data/lib/poolparty/helpers/provisioner_base.rb +18 -11
- data/lib/poolparty/helpers/provisioners/master.rb +24 -22
- data/lib/poolparty/helpers/provisioners/slave.rb +8 -4
- data/lib/poolparty/modules/definable_resource.rb +1 -0
- data/lib/poolparty/modules/file_writer.rb +11 -10
- data/lib/poolparty/modules/method_missing_sugar.rb +1 -1
- data/lib/poolparty/modules/pretty_printer.rb +11 -11
- data/lib/poolparty/modules/resourcing_dsl.rb +61 -0
- data/lib/poolparty/monitors/base_monitor.rb +17 -3
- data/lib/poolparty/monitors/monitors/cpu_monitor.rb +15 -0
- data/lib/poolparty/monitors/monitors/memory_monitor.rb +23 -0
- data/lib/poolparty/net/remote_instance.rb +6 -1
- data/lib/poolparty/net/remoter.rb +23 -5
- data/lib/poolparty/net/remoter_base.rb +5 -1
- data/lib/poolparty/plugins/git.rb +22 -24
- data/lib/poolparty/pool/base.rb +22 -6
- data/lib/poolparty/pool/cloud.rb +28 -4
- data/lib/poolparty/pool/custom_resource.rb +6 -6
- data/lib/poolparty/pool/loggable.rb +3 -0
- data/lib/poolparty/pool/pool.rb +1 -1
- data/lib/poolparty/pool/resource.rb +58 -94
- data/lib/poolparty/pool/resources/class_package.rb +6 -6
- data/lib/poolparty/pool/resources/conditional.rb +5 -1
- data/lib/poolparty/pool/resources/exec.rb +6 -2
- data/lib/poolparty/pool/resources/gem.rb +22 -8
- data/lib/poolparty/pool/resources/remote_file.rb +5 -1
- data/lib/poolparty/pool/resources/symlink.rb +25 -0
- data/lib/poolparty/pool/resources/variable.rb +8 -7
- data/lib/poolparty/pool/tmp/.ppkeys +3 -0
- data/lib/poolparty/pool/tmp/happydayz +1 -0
- data/lib/poolparty/pool/tmp/install_master.sh +33 -0
- data/lib/poolparty/pool/tmp/pool.spec +11 -0
- data/lib/poolparty/pool/tmp/poolparty.pp +600 -0
- data/lib/poolparty/pool/tmp/tc-instances.list +1 -0
- data/lib/poolparty/templates/cib.xml +54 -0
- data/lib/poolparty/templates/ha.cf +12 -3
- data/lib/poolparty/templates/haproxy.conf +3 -3
- data/lib/poolparty/templates/haresources +3 -0
- data/lib/poolparty/templates/poolparty.monitor +14 -0
- data/lib/poolparty/templates/puppet.conf +3 -4
- data/lib/poolparty/version.rb +1 -1
- data/lib/poolparty.rb +9 -6
- data/poolparty.gemspec +7 -6
- data/setup.rb +3 -3
- data/spec/poolparty/bin/console_spec.rb +1 -1
- data/spec/poolparty/core/array_spec.rb +5 -0
- data/spec/poolparty/core/hash_spec.rb +19 -1
- data/spec/poolparty/core/string_spec.rb +13 -0
- data/spec/poolparty/dependency_resolutions/base_spec.rb +11 -0
- data/spec/poolparty/helpers/messenger_spec.rb +14 -0
- data/spec/poolparty/helpers/optioner_spec.rb +2 -1
- data/spec/poolparty/helpers/provisioner_base_spec.rb +1 -1
- data/spec/poolparty/helpers/provisioners/master_spec.rb +2 -2
- data/spec/poolparty/helpers/provisioners/slave_spec.rb +3 -3
- data/spec/poolparty/modules/file_writer_spec.rb +9 -0
- data/spec/poolparty/monitors/base_monitor_spec.rb +19 -0
- data/spec/poolparty/monitors/monitors/cpu_monitor_spec.rb +17 -0
- data/spec/poolparty/net/remote_instance_spec.rb +6 -1
- data/spec/poolparty/net/remote_spec.rb +51 -42
- data/spec/poolparty/net/remoter_spec.rb +2 -1
- data/spec/poolparty/plugins/git_spec.rb +2 -2
- data/spec/poolparty/pool/base_spec.rb +20 -2
- data/spec/poolparty/pool/cloud_spec.rb +30 -1
- data/spec/poolparty/pool/custom_resource_spec.rb +2 -2
- data/spec/poolparty/pool/plugin_spec.rb +4 -4
- data/spec/poolparty/pool/pool_spec.rb +1 -1
- data/spec/poolparty/pool/resource_spec.rb +66 -0
- data/spec/poolparty/pool/resources/gem_spec.rb +29 -3
- data/spec/poolparty/pool/resources/symlink_spec.rb +22 -0
- data/spec/poolparty/pool/resources/variable_spec.rb +4 -0
- data/spec/poolparty/spec_helper.rb +5 -0
- data/tasks/cloud.rake +0 -54
- data/tasks/development.rake +0 -12
- data/tasks/ec2.rake +1 -16
- data/tasks/instance.rake +0 -61
- data/test_manifest.pp +286 -166
- data/website/index.html +5 -5
- data/website/index.txt +3 -3
- metadata +137 -8
- data/bin/pool-start-monitor +0 -1
- data/lib/erlang/eb_server.erl +0 -27
- data/lib/poolparty/plugins/gem_package.rb +0 -17
- data/spec/poolparty/modules/tmp/willy/nilly.rb +0 -1
|
@@ -15,10 +15,10 @@ describe "Base" do
|
|
|
15
15
|
Base.base_keypair_path.should == "~/.ec2"
|
|
16
16
|
end
|
|
17
17
|
it "should set the storage_directory to the tmp directory of the current working directory" do
|
|
18
|
-
Base.storage_directory.should
|
|
18
|
+
Base.storage_directory.should =~ /tmp/
|
|
19
19
|
end
|
|
20
20
|
it "should set the tmp path to tmp" do
|
|
21
|
-
Base.tmp_path.should
|
|
21
|
+
Base.tmp_path.should =~ /\/tmp/
|
|
22
22
|
end
|
|
23
23
|
it "should set the remote storage path to /var/poolparty" do
|
|
24
24
|
Base.remote_storage_path.should == "/var/poolparty"
|
|
@@ -104,5 +104,23 @@ describe "Base" do
|
|
|
104
104
|
Base.store_keys_in_file
|
|
105
105
|
end
|
|
106
106
|
end
|
|
107
|
+
describe "allowed_commands" do
|
|
108
|
+
before(:each) do
|
|
109
|
+
@str =<<-EOE
|
|
110
|
+
echo 'hello world'
|
|
111
|
+
EOE
|
|
112
|
+
@str.stub!(:read).and_return @str
|
|
113
|
+
Base.stub!(:open).and_return @str
|
|
114
|
+
end
|
|
115
|
+
it "should load the yaml file allowed_commands.yml" do
|
|
116
|
+
Base.allowed_commands.class.should == Array
|
|
117
|
+
end
|
|
118
|
+
it "should have the command echo 'hello world' in the list of allowed_commands" do
|
|
119
|
+
Base.allowed_commands.include?("echo 'hello world'").should == true
|
|
120
|
+
end
|
|
121
|
+
it "should not have the command rm -rf / in the list of allowed commands" do
|
|
122
|
+
Base.allowed_commands.include?("rm -rf /").should == false
|
|
123
|
+
end
|
|
124
|
+
end
|
|
107
125
|
end
|
|
108
126
|
end
|
|
@@ -170,7 +170,7 @@ describe "Cloud" do
|
|
|
170
170
|
hello my lady
|
|
171
171
|
EOE
|
|
172
172
|
end
|
|
173
|
-
|
|
173
|
+
has_gempackage(:name => "poolparty")
|
|
174
174
|
has_package(:name => "dummy")
|
|
175
175
|
end
|
|
176
176
|
end
|
|
@@ -279,6 +279,21 @@ describe "Cloud" do
|
|
|
279
279
|
@manifest.should =~ /host \{\n\t\t"master":/
|
|
280
280
|
end
|
|
281
281
|
end
|
|
282
|
+
describe "building with an existing manifest" do
|
|
283
|
+
before(:each) do
|
|
284
|
+
@file = "/etc/puppet/manifests/nodes/nodes.pp"
|
|
285
|
+
@file.stub!(:read).and_return "nodes"
|
|
286
|
+
::FileTest.stub!(:file?).with("/etc/puppet/manifests/classes/poolparty.pp").and_return true
|
|
287
|
+
@cloud.stub!(:open).with("/etc/puppet/manifests/classes/poolparty.pp").and_return @file
|
|
288
|
+
end
|
|
289
|
+
it "should not call resources_string_from_resources if the file /etc/puppet/manifests/nodes/nodes.pp exists" do
|
|
290
|
+
@cloud.should_not_receive(:add_poolparty_base_requirements)
|
|
291
|
+
@cloud.build_manifest
|
|
292
|
+
end
|
|
293
|
+
it "should build from the existing file" do
|
|
294
|
+
@cloud.build_manifest.should == "nodes"
|
|
295
|
+
end
|
|
296
|
+
end
|
|
282
297
|
end
|
|
283
298
|
end
|
|
284
299
|
|
|
@@ -295,5 +310,19 @@ describe "Cloud" do
|
|
|
295
310
|
end
|
|
296
311
|
end
|
|
297
312
|
|
|
313
|
+
describe "provisioning" do
|
|
314
|
+
it "should be able to tell that it is provisioning when setting the provisioning flag" do
|
|
315
|
+
@cloud.provisioning?.should == false
|
|
316
|
+
end
|
|
317
|
+
it "should be able to set it as provisioning" do
|
|
318
|
+
@cloud.provisioning_in_progress
|
|
319
|
+
@cloud.provisioning?.should == true
|
|
320
|
+
end
|
|
321
|
+
it "should be able to unset itself as provisioning" do
|
|
322
|
+
@cloud.provisioning_in_progress
|
|
323
|
+
@cloud.provisioning_complete
|
|
324
|
+
@cloud.provisioning?.should == false
|
|
325
|
+
end
|
|
326
|
+
end
|
|
298
327
|
end
|
|
299
328
|
end
|
|
@@ -80,10 +80,10 @@ describe "Custom Resource" do
|
|
|
80
80
|
end
|
|
81
81
|
it "should create a new CallFunction instance when calling call_function with a string" do
|
|
82
82
|
PoolParty::Resources::CallFunction.should_receive(:new).and_return "bunk"
|
|
83
|
-
add_resource(:call_function, "line")
|
|
83
|
+
add_resource(:call_function, :name => "line")
|
|
84
84
|
end
|
|
85
85
|
it "should create a call function in the function call array" do
|
|
86
|
-
add_resource(:call_function,
|
|
86
|
+
add_resource(:call_function, {:name => "custom_function"}, @cloud)
|
|
87
87
|
resource(:call_function).size.should == 1
|
|
88
88
|
end
|
|
89
89
|
describe "defining" do
|
|
@@ -39,7 +39,7 @@ describe "Plugin" do
|
|
|
39
39
|
before(:each) do
|
|
40
40
|
@plugin.instance_eval do
|
|
41
41
|
enable_php
|
|
42
|
-
|
|
42
|
+
has_gempackage(:name => "aska")
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
it "should call enable_php on the class" do
|
|
@@ -49,13 +49,13 @@ describe "Plugin" do
|
|
|
49
49
|
@plugin.resources.class.should == Hash
|
|
50
50
|
end
|
|
51
51
|
it "should have an array of gem resources" do
|
|
52
|
-
@plugin.resource(:
|
|
52
|
+
@plugin.resource(:gempackage).class.should == Array
|
|
53
53
|
end
|
|
54
54
|
it "should have 1 gem in the resources defined" do
|
|
55
|
-
@plugin.resource(:
|
|
55
|
+
@plugin.resource(:gempackage).size.should == 1
|
|
56
56
|
end
|
|
57
57
|
it "should have the gem named aska in the gem resource" do
|
|
58
|
-
@plugin.resource(:
|
|
58
|
+
@plugin.resource(:gempackage).first.name.should == "aska"
|
|
59
59
|
end
|
|
60
60
|
it "should have its resources visible to its parent" do
|
|
61
61
|
@plugin.parent = @c
|
|
@@ -37,7 +37,7 @@ describe "Pool" do
|
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
it "should call Dir when the plugin directory is set" do
|
|
40
|
-
Dir.should_receive(:[]).with("yaway
|
|
40
|
+
Dir.should_receive(:[]).with("yaway/*/*.rb").once.and_return []
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
describe "configuration" do
|
|
@@ -131,6 +131,13 @@ describe "Resource" do
|
|
|
131
131
|
include PoolParty::Resources
|
|
132
132
|
before(:each) do
|
|
133
133
|
reset_resources!
|
|
134
|
+
@cloud = cloud :command_cloud do; end
|
|
135
|
+
end
|
|
136
|
+
it "should call add_resource when creating using the command: file" do
|
|
137
|
+
@cloud.should_receive(:add_resource).with(:file, {:name => "frank"}, @cloud)
|
|
138
|
+
@cloud.instance_eval do
|
|
139
|
+
file(:name => "frank")
|
|
140
|
+
end
|
|
134
141
|
end
|
|
135
142
|
it "should create the new 'resource' as a resource" do
|
|
136
143
|
resource(:file).class.should == Array
|
|
@@ -220,5 +227,64 @@ describe "Resource" do
|
|
|
220
227
|
@file.parent.tangerine.should == "orange"
|
|
221
228
|
end
|
|
222
229
|
end
|
|
230
|
+
describe "appending to resource" do
|
|
231
|
+
before(:each) do
|
|
232
|
+
@cloud1 = cloud :apples do
|
|
233
|
+
directory(:name => "/var/www") do
|
|
234
|
+
file(:name => "/var/www/file.html")
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
@dir = @cloud1.get_resource(:directory, "/var/www")
|
|
238
|
+
@file = @dir.get_resource(:file, "/var/www/file.html")
|
|
239
|
+
end
|
|
240
|
+
it "should say there is 1 resource because the lower-level resources should be contained on the parenting resource" do
|
|
241
|
+
@cloud1.resources.size.should == 1
|
|
242
|
+
end
|
|
243
|
+
it "should say there is one resource on the outer resource" do
|
|
244
|
+
@dir.resources.size.should == 1
|
|
245
|
+
end
|
|
246
|
+
it "should contain the file as a resource" do
|
|
247
|
+
@dir.resource(:file)[0].to_s.should == @file.to_s
|
|
248
|
+
end
|
|
249
|
+
it "should set the parent as the parenting resource" do
|
|
250
|
+
@file.parent.to_s.should == @dir.to_s
|
|
251
|
+
end
|
|
252
|
+
end
|
|
253
|
+
describe "fetching" do
|
|
254
|
+
before(:each) do
|
|
255
|
+
@file = file(:name => "pancakes")
|
|
256
|
+
end
|
|
257
|
+
it "should not create a new resource if the same resource exists" do
|
|
258
|
+
PoolParty::Resources::File.should_not_receive(:new)
|
|
259
|
+
file(:name => "pancakes")
|
|
260
|
+
end
|
|
261
|
+
it "should return the file preiously created" do
|
|
262
|
+
get_resource(:file, "pancakes").should == @file
|
|
263
|
+
end
|
|
264
|
+
it "should be able to use the helper to grab the file" do
|
|
265
|
+
PoolParty::Resources::File.should_not_receive(:new)
|
|
266
|
+
file(:name => "pancakes").should == @file
|
|
267
|
+
end
|
|
268
|
+
it "should turn the resource into a string" do
|
|
269
|
+
@file.to_s.should == "File['pancakes']"
|
|
270
|
+
end
|
|
271
|
+
describe "cancelled" do
|
|
272
|
+
it "should make a resource not cancelled by default" do
|
|
273
|
+
@file.cancelled?.should == false
|
|
274
|
+
end
|
|
275
|
+
it "should say cancelled? is true if it has been cancelled" do
|
|
276
|
+
@file.cancel
|
|
277
|
+
@file.cancelled?.should == true
|
|
278
|
+
end
|
|
279
|
+
end
|
|
280
|
+
describe "virtual_resources" do
|
|
281
|
+
before(:each) do
|
|
282
|
+
@virtual_resource = git(:name => "tank", :source => "git://github.com/auser/testgit.git")
|
|
283
|
+
end
|
|
284
|
+
it "should fetch a virtual resource the same" do
|
|
285
|
+
git(:name => "tank", :source => "git://github.com/auser/testgit.git").to_s.should == @virtual_resource.to_s
|
|
286
|
+
end
|
|
287
|
+
end
|
|
288
|
+
end
|
|
223
289
|
end
|
|
224
290
|
end
|
|
@@ -5,12 +5,38 @@ include PoolParty::Resources
|
|
|
5
5
|
describe "Gem" do
|
|
6
6
|
before(:each) do
|
|
7
7
|
reset!
|
|
8
|
-
@
|
|
8
|
+
@cloud = cloud :gem_cloud do
|
|
9
|
+
has_gempackage(:name => "activesupport") do
|
|
10
|
+
has_gempackage(:name => "rails")
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
@gem = @cloud.resource(:gempackage).first
|
|
9
14
|
end
|
|
10
15
|
it "should have a package" do
|
|
11
|
-
resource(:
|
|
16
|
+
@cloud.resource(:gempackage).should_not be_empty
|
|
17
|
+
end
|
|
18
|
+
it "should have the name set as activesupport" do
|
|
19
|
+
@gem.name.should == "activesupport"
|
|
12
20
|
end
|
|
13
21
|
it "should have the 'rails' gem in the packages" do
|
|
14
|
-
@
|
|
22
|
+
@cloud.resource(:gempackage).first.to_string.should =~ /rails/
|
|
23
|
+
end
|
|
24
|
+
describe "with parent options" do
|
|
25
|
+
before(:each) do
|
|
26
|
+
reset_all!
|
|
27
|
+
@cloud1 = cloud :gem_version_cloud do
|
|
28
|
+
has_gempackage(:name => "ParseTree", :version => "2.2.0") do
|
|
29
|
+
has_gempackage(:name => "edge-rails")
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
@gem = @cloud1.resource(:gempackage).first
|
|
33
|
+
@gem2 = @gem.resource(:gempackage).first
|
|
34
|
+
end
|
|
35
|
+
it "should have the version set on the parent" do
|
|
36
|
+
@gem.version.should == "2.2.0"
|
|
37
|
+
end
|
|
38
|
+
it "should not take the version of the parent on the child" do
|
|
39
|
+
@gem2.version.should == nil
|
|
40
|
+
end
|
|
15
41
|
end
|
|
16
42
|
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
|
+
|
|
3
|
+
include PoolParty::Resources
|
|
4
|
+
|
|
5
|
+
describe "Symlink" do
|
|
6
|
+
before(:each) do
|
|
7
|
+
reset_resources!
|
|
8
|
+
@cloud = cloud :symlink_test do
|
|
9
|
+
has_symlink(:name => "/etc/apache2/puppetmaster.conf", :source => "/etc/http/puppetmaster.conf")
|
|
10
|
+
end
|
|
11
|
+
@symlink = @cloud.resource(:symlink).first
|
|
12
|
+
end
|
|
13
|
+
it "should create a file" do
|
|
14
|
+
@cloud.resource(:symlink).empty?.should == false
|
|
15
|
+
end
|
|
16
|
+
it "should create a file { resource" do
|
|
17
|
+
@symlink.to_string.should =~ /file \{/
|
|
18
|
+
end
|
|
19
|
+
it "should use the from for the ensures" do
|
|
20
|
+
@symlink.ensure.should == @symlink.source
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -17,4 +17,8 @@ describe "Variable" do
|
|
|
17
17
|
v = variable(:name => "girlfriends", :value => %w(Rachel Erica Michelle))
|
|
18
18
|
v.to_string.should == "$girlfriends = [ 'Rachel', 'Erica', 'Michelle' ]"
|
|
19
19
|
end
|
|
20
|
+
it "should set the string to be without a string if it's a function" do
|
|
21
|
+
v = variable(:name => "girlfriends", :value => "lookup_var()")
|
|
22
|
+
v.to_string.should == "$girlfriends = lookup_var()"
|
|
23
|
+
end
|
|
20
24
|
end
|
|
@@ -17,6 +17,10 @@ extend PoolParty
|
|
|
17
17
|
Base.environment = "test"
|
|
18
18
|
Base.verbose = false
|
|
19
19
|
|
|
20
|
+
def setup_cl
|
|
21
|
+
require 'poolpartycl'
|
|
22
|
+
end
|
|
23
|
+
|
|
20
24
|
def stub_option_load
|
|
21
25
|
@str=<<-EOS
|
|
22
26
|
:access_key:
|
|
@@ -38,6 +42,7 @@ def wait_launch(time=5)
|
|
|
38
42
|
Process.wait(pid, 0)
|
|
39
43
|
end
|
|
40
44
|
def reset_all!
|
|
45
|
+
$cloud = nil
|
|
41
46
|
end
|
|
42
47
|
def read_file(path)
|
|
43
48
|
require "open-uri"
|
data/tasks/cloud.rake
CHANGED
|
@@ -1,57 +1,3 @@
|
|
|
1
1
|
# Cloud tasks
|
|
2
2
|
namespace(:cloud) do
|
|
3
|
-
# Setup
|
|
4
|
-
task :init do
|
|
5
|
-
setup_application
|
|
6
|
-
raise Exception.new("You must specify your access_key and secret_access_key") unless Base.access_key && Base.secret_access_key
|
|
7
|
-
end
|
|
8
|
-
# Install the stack on all of the nodes
|
|
9
|
-
desc "Prepare all servers"
|
|
10
|
-
task :prepare => :init do
|
|
11
|
-
PoolParty::Master.new.nodes.each do |node|
|
|
12
|
-
node.install
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
# Start the cloud
|
|
16
|
-
desc "Start the cloud"
|
|
17
|
-
task :start => :init do
|
|
18
|
-
PoolParty::Master.new.start_cloud!
|
|
19
|
-
end
|
|
20
|
-
# Reload the cloud with the new updated data
|
|
21
|
-
desc "Reload all instances with updated data"
|
|
22
|
-
task :reload => :init do
|
|
23
|
-
PoolParty::Master.new.nodes.each do |node|
|
|
24
|
-
node.configure
|
|
25
|
-
node.restart_with_monit
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
# List the cloud
|
|
29
|
-
desc "List cloud"
|
|
30
|
-
task :list => :init do
|
|
31
|
-
puts PoolParty::Master.new.list
|
|
32
|
-
end
|
|
33
|
-
# Shutdown the cloud
|
|
34
|
-
desc "Shutdown the entire cloud"
|
|
35
|
-
task :shutdown => :init do
|
|
36
|
-
PoolParty::Master.new.request_termination_of_all_instances
|
|
37
|
-
end
|
|
38
|
-
# Watch the cloud and scale it if necessary
|
|
39
|
-
desc "Watch the cloud and maintain it"
|
|
40
|
-
task :scale => :init do
|
|
41
|
-
begin
|
|
42
|
-
PoolParty::Master.new.scale_cloud!
|
|
43
|
-
rescue Exception => e
|
|
44
|
-
puts "There was an error scaling the cloud: #{e}"
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
end
|
|
48
|
-
# Maintain the cloud in a background process
|
|
49
|
-
desc "Maintain the cloud (run on the master)"
|
|
50
|
-
task :maintain => :init do
|
|
51
|
-
begin
|
|
52
|
-
PoolParty::Master.new.start_monitor!
|
|
53
|
-
rescue Exception => e
|
|
54
|
-
puts "There was an error starting the monitor: #{e}"
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
3
|
end
|
data/tasks/development.rake
CHANGED
|
@@ -56,18 +56,6 @@ To work on this cloud, source the file like:
|
|
|
56
56
|
end
|
|
57
57
|
desc "initialize setup"
|
|
58
58
|
task :init => [:setup_pemkeys]
|
|
59
|
-
|
|
60
|
-
desc "Just an argv test"
|
|
61
|
-
task :test => :initialize do
|
|
62
|
-
puts "---- Testing ----"
|
|
63
|
-
puts PoolParty.options(ARGV.dup)
|
|
64
|
-
puts "Using keypair at: #{Base.keypair_path}"
|
|
65
|
-
end
|
|
66
|
-
desc "Installation listing"
|
|
67
|
-
task :list_install => :initialize do
|
|
68
|
-
puts "-- packages to install --"
|
|
69
|
-
Provider.install_PoolParty(true)
|
|
70
|
-
end
|
|
71
59
|
desc "Authorize base ports for application"
|
|
72
60
|
task :authorize_ports => :initialize do
|
|
73
61
|
run <<-EOR
|
data/tasks/ec2.rake
CHANGED
|
@@ -1,20 +1,5 @@
|
|
|
1
|
-
namespace(:ec2) do
|
|
1
|
+
namespace(:ec2) do
|
|
2
2
|
task :init do
|
|
3
3
|
%x[ec2-authorize default -P icmp -t -1:-1 -s 0.0.0.0/0]
|
|
4
4
|
end
|
|
5
|
-
# Start a new instance in the cloud
|
|
6
|
-
desc "Add and start an instance to the pool"
|
|
7
|
-
task :start_new_instance => [:init] do
|
|
8
|
-
puts PoolParty::Remoting.new.launch_new_instance!
|
|
9
|
-
end
|
|
10
|
-
# Stop all the instances via command-line
|
|
11
|
-
desc "Stop all running instances"
|
|
12
|
-
task :stop_running_instances => [:init] do
|
|
13
|
-
Thread.new {`ec2-describe-instances | grep INSTANCE | grep running | awk '{print $2}' | xargs ec2-terminate-instances`}
|
|
14
|
-
end
|
|
15
|
-
# Reboot the instances via commandline
|
|
16
|
-
desc "Restart all running instances"
|
|
17
|
-
task :restart_running_instances => [:init] do
|
|
18
|
-
Thread.new {`ec2-describe-instances | grep INSTANCE | grep running | awk '{print $2}' | xargs ec2-reboot-instances`}
|
|
19
|
-
end
|
|
20
5
|
end
|
data/tasks/instance.rake
CHANGED
|
@@ -1,63 +1,2 @@
|
|
|
1
1
|
namespace(:instance) do
|
|
2
|
-
# Find the instance we want to deal with
|
|
3
|
-
# interface can be: num=0, i=0, inst=0, 0
|
|
4
|
-
# defaults to the master instance (0)
|
|
5
|
-
task :init do
|
|
6
|
-
num = (ENV['num'] || ENV["i"] || ENV["inst"] || ARGV.shift || 0).to_i
|
|
7
|
-
raise Exception.new("Please set the number of the instance (i.e. num=1, i=1, or as an argument)") unless num
|
|
8
|
-
@node = PoolParty::Master.new.get_node(num)
|
|
9
|
-
end
|
|
10
|
-
# Ssh into the node
|
|
11
|
-
desc "Remotely login to the remote instance"
|
|
12
|
-
task :ssh => [:init] do
|
|
13
|
-
@node.ssh
|
|
14
|
-
end
|
|
15
|
-
desc "Send a file to the remote instance"
|
|
16
|
-
task :exec => :init do
|
|
17
|
-
@node.ssh ENV['cmd']
|
|
18
|
-
end
|
|
19
|
-
# Send a file to the remote instance
|
|
20
|
-
# as designated by src='' and dest=''
|
|
21
|
-
desc "Send a file to the remote instance"
|
|
22
|
-
task :scp => :init do
|
|
23
|
-
@node.scp ENV['src'], ENV['dest']
|
|
24
|
-
end
|
|
25
|
-
# Execute a command on the remote instance as designated
|
|
26
|
-
# by cmd=''
|
|
27
|
-
desc "Execute cmd on a remote instance"
|
|
28
|
-
task :exec => [:init] do
|
|
29
|
-
cmd = ENV['cmd'] || "ls -l"
|
|
30
|
-
puts @node.ssh(cmd.runnable)
|
|
31
|
-
end
|
|
32
|
-
# Restart all the services monitored by monit
|
|
33
|
-
desc "Restart all the services"
|
|
34
|
-
task :reload => [:init] do
|
|
35
|
-
@node.restart_with_monit
|
|
36
|
-
end
|
|
37
|
-
# Start all the services monitored by monit
|
|
38
|
-
desc "Start all services"
|
|
39
|
-
task :load => [:init] do
|
|
40
|
-
@node.start_with_monit
|
|
41
|
-
end
|
|
42
|
-
# Stop the services monitored by monit
|
|
43
|
-
desc "Stop all services"
|
|
44
|
-
task :stop => [:init] do
|
|
45
|
-
@node.stop_with_monit
|
|
46
|
-
end
|
|
47
|
-
# Install the required services on this node
|
|
48
|
-
desc "Install stack on this node"
|
|
49
|
-
task :install => :init do
|
|
50
|
-
@node.install
|
|
51
|
-
end
|
|
52
|
-
# Turnoff this instance
|
|
53
|
-
desc "Teardown instance"
|
|
54
|
-
task :shutdown => :init do
|
|
55
|
-
`ec2-terminate-instances #{@node.instance_id}`
|
|
56
|
-
end
|
|
57
|
-
# Configure this node and start the services
|
|
58
|
-
desc "Configure the stack on this node"
|
|
59
|
-
task :configure => :init do
|
|
60
|
-
@node.configure
|
|
61
|
-
@node.restart_with_monit
|
|
62
|
-
end
|
|
63
2
|
end
|