poolparty 0.0.4 → 0.2.6
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/History.txt +25 -0
- data/License.txt +20 -0
- data/Manifest.txt +203 -0
- data/PostInstall.txt +18 -0
- data/README.txt +21 -82
- data/Rakefile +25 -18
- data/bin/cloud +31 -0
- data/bin/cloud-add-keypair +23 -0
- data/bin/cloud-configure +31 -0
- data/bin/cloud-contract +27 -0
- data/bin/cloud-expand +27 -0
- data/bin/cloud-list +32 -0
- data/bin/cloud-maintain +36 -0
- data/bin/cloud-osxcopy +22 -0
- data/bin/cloud-provision +31 -0
- data/bin/cloud-refresh +26 -0
- data/bin/cloud-ssh +18 -0
- data/bin/cloud-start +32 -0
- data/bin/cloud-terminate +23 -0
- data/bin/pool +25 -27
- data/bin/pool-console +12 -0
- data/bin/pool-describe +9 -0
- data/bin/pool-list +28 -0
- data/bin/pool-provision +34 -0
- data/bin/pool-spec +17 -0
- data/bin/pool-start +32 -0
- data/bin/pool-start-monitor +1 -0
- data/config/hoe.rb +115 -0
- data/config/requirements.rb +15 -0
- data/examples/basic.rb +20 -0
- data/examples/plugin_without_plugin_directory.rb +13 -0
- data/examples/poolparty.rb +12 -0
- data/examples/with_apache_plugin.rb +22 -0
- data/generators/poolspec/USAGE +5 -0
- data/generators/poolspec/poolspec_generator.rb +65 -0
- data/generators/poolspec/templates/pool_spec_template.erb +9 -0
- data/lib/erlang/eb_server.erl +27 -0
- data/lib/poolparty.rb +56 -0
- data/lib/poolparty/base_packages/haproxy.rb +42 -0
- data/lib/poolparty/base_packages/heartbeat.rb +45 -0
- data/lib/poolparty/base_packages/poolparty.rb +36 -0
- data/lib/poolparty/base_packages/ruby.rb +43 -0
- data/lib/poolparty/core/array.rb +24 -0
- data/lib/{core → poolparty/core}/exception.rb +0 -0
- data/lib/poolparty/core/float.rb +13 -0
- data/lib/poolparty/core/hash.rb +29 -0
- data/lib/poolparty/core/kernel.rb +37 -0
- data/lib/{core → poolparty/core}/module.rb +18 -0
- data/lib/poolparty/core/my_open_struct.rb +18 -0
- data/lib/poolparty/core/object.rb +54 -0
- data/lib/poolparty/core/proc.rb +7 -0
- data/lib/poolparty/core/string.rb +72 -0
- data/lib/poolparty/core/symbol.rb +8 -0
- data/lib/{core → poolparty/core}/time.rb +15 -0
- data/lib/poolparty/exceptions/RemoteException.rb +12 -0
- data/lib/poolparty/exceptions/ResourceException.rb +7 -0
- data/lib/poolparty/exceptions/RuntimeException.rb +7 -0
- data/lib/poolparty/exceptions/SpecException.rb +7 -0
- data/lib/poolparty/exceptions/TemplateNotFound.rb +7 -0
- data/lib/poolparty/helpers/binary.rb +31 -0
- data/lib/poolparty/helpers/console.rb +30 -0
- data/lib/poolparty/helpers/display.rb +34 -0
- data/lib/poolparty/helpers/optioner.rb +64 -0
- data/lib/poolparty/helpers/provisioner_base.rb +250 -0
- data/lib/poolparty/helpers/provisioners/master.rb +136 -0
- data/lib/poolparty/helpers/provisioners/slave.rb +44 -0
- data/lib/poolparty/modules/cloud_resourcer.rb +89 -0
- data/lib/poolparty/modules/configurable.rb +34 -0
- data/lib/poolparty/modules/definable_resource.rb +59 -0
- data/lib/poolparty/modules/file_writer.rb +55 -0
- data/lib/poolparty/modules/method_missing_sugar.rb +53 -0
- data/lib/poolparty/modules/output.rb +13 -0
- data/lib/poolparty/modules/pretty_printer.rb +39 -0
- data/lib/{core/string.rb → poolparty/modules/s3_string.rb} +5 -22
- data/lib/{modules → poolparty/modules}/safe_instance.rb +0 -0
- data/lib/poolparty/monitors/base_monitor.rb +16 -0
- data/lib/poolparty/net/remote.rb +35 -0
- data/lib/poolparty/net/remote_bases/ec2.rb +148 -0
- data/lib/poolparty/net/remote_instance.rb +69 -0
- data/lib/poolparty/net/remoter.rb +224 -0
- data/lib/poolparty/net/remoter_base.rb +117 -0
- data/lib/poolparty/plugins/gem_package.rb +17 -0
- data/lib/poolparty/plugins/git.rb +41 -0
- data/lib/poolparty/plugins/line.rb +76 -0
- data/lib/poolparty/plugins/svn.rb +48 -0
- data/lib/poolparty/pool/base.rb +75 -0
- data/lib/poolparty/pool/cloud.rb +164 -0
- data/lib/poolparty/pool/custom_resource.rb +61 -0
- data/lib/poolparty/pool/loggable.rb +29 -0
- data/lib/poolparty/pool/plugin.rb +41 -0
- data/lib/poolparty/pool/plugin_model.rb +48 -0
- data/lib/poolparty/pool/pool.rb +55 -0
- data/lib/poolparty/pool/resource.rb +248 -0
- data/lib/poolparty/pool/resources/class_package.rb +64 -0
- data/lib/poolparty/pool/resources/conditional.rb +41 -0
- data/lib/poolparty/pool/resources/cron.rb +14 -0
- data/lib/poolparty/pool/resources/directory.rb +23 -0
- data/lib/poolparty/pool/resources/exec.rb +26 -0
- data/lib/poolparty/pool/resources/file.rb +23 -0
- data/lib/poolparty/pool/resources/gem.rb +14 -0
- data/lib/poolparty/pool/resources/host.rb +14 -0
- data/lib/poolparty/pool/resources/package.rb +14 -0
- data/lib/poolparty/pool/resources/remote_file.rb +22 -0
- data/lib/poolparty/pool/resources/service.rb +21 -0
- data/lib/poolparty/pool/resources/sshkey.rb +19 -0
- data/lib/poolparty/pool/resources/variable.rb +27 -0
- data/lib/poolparty/pool/script.rb +44 -0
- data/lib/poolparty/templates/authkeys +2 -0
- data/{config/monit/nginx.monit.conf → lib/poolparty/templates/cib.xml} +0 -0
- data/lib/poolparty/templates/fileserver.conf +4 -0
- data/lib/poolparty/templates/gem +25 -0
- data/{config/heartbeat.conf → lib/poolparty/templates/ha.cf} +3 -2
- data/{config → lib/poolparty/templates}/haproxy.conf +13 -6
- data/lib/poolparty/templates/namespaceauth.conf +19 -0
- data/lib/poolparty/templates/puppet.conf +17 -0
- data/lib/poolparty/version.rb +9 -0
- data/lib/poolpartycl.rb +3 -0
- data/poolparty.gemspec +56 -47
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +82 -0
- data/setup.rb +1585 -0
- data/spec/poolparty/base_packages/haproxy_spec.rb +13 -0
- data/spec/poolparty/base_packages/heartbeat_spec.rb +30 -0
- data/spec/poolparty/bin/console_spec.rb +80 -0
- data/spec/poolparty/core/array_spec.rb +26 -0
- data/spec/poolparty/core/float.rb +13 -0
- data/spec/poolparty/core/hash_spec.rb +63 -0
- data/spec/poolparty/core/kernel_spec.rb +24 -0
- data/spec/poolparty/core/module_spec.rb +15 -0
- data/spec/poolparty/core/object_spec.rb +40 -0
- data/spec/poolparty/core/string_spec.rb +152 -0
- data/spec/poolparty/core/time_spec.rb +52 -0
- data/spec/poolparty/helpers/binary_spec.rb +26 -0
- data/spec/poolparty/helpers/display_spec.rb +13 -0
- data/spec/poolparty/helpers/optioner_spec.rb +39 -0
- data/spec/poolparty/helpers/provisioner_base_spec.rb +121 -0
- data/spec/poolparty/helpers/provisioners/master_spec.rb +54 -0
- data/spec/poolparty/helpers/provisioners/slave_spec.rb +28 -0
- data/spec/poolparty/modules/cloud_resourcer_spec.rb +135 -0
- data/spec/poolparty/modules/configurable_spec.rb +26 -0
- data/spec/poolparty/modules/definable_resource.rb +9 -0
- data/spec/poolparty/modules/file_writer_spec.rb +49 -0
- data/spec/poolparty/modules/s3_string_spec.rb +15 -0
- data/spec/poolparty/modules/tmp/willy/nilly.rb +1 -0
- data/spec/poolparty/net/remote_bases/ec2_spec.rb +92 -0
- data/spec/poolparty/net/remote_instance_spec.rb +70 -0
- data/spec/poolparty/net/remote_spec.rb +286 -0
- data/spec/poolparty/net/remoter_base_spec.rb +80 -0
- data/spec/poolparty/net/remoter_spec.rb +191 -0
- data/spec/poolparty/plugins/git_spec.rb +33 -0
- data/spec/poolparty/plugins/line_spec.rb +16 -0
- data/spec/poolparty/plugins/svn_spec.rb +16 -0
- data/spec/poolparty/pool/base_spec.rb +108 -0
- data/spec/poolparty/pool/cloud_spec.rb +299 -0
- data/spec/poolparty/pool/configurers/files/ruby_basic.rb +17 -0
- data/spec/poolparty/pool/configurers/files/ruby_plugins.rb +16 -0
- data/spec/poolparty/pool/configurers/ruby_spec.rb +58 -0
- data/spec/poolparty/pool/custom_resource_spec.rb +115 -0
- data/spec/poolparty/pool/example_spec.rb +112 -0
- data/spec/poolparty/pool/plugin_model_spec.rb +63 -0
- data/spec/poolparty/pool/plugin_spec.rb +85 -0
- data/spec/poolparty/pool/pool_spec.rb +83 -0
- data/spec/poolparty/pool/resource_spec.rb +224 -0
- data/spec/poolparty/pool/resources/class_package_spec.rb +84 -0
- data/spec/poolparty/pool/resources/conditional_spec.rb +38 -0
- data/spec/poolparty/pool/resources/cron_spec.rb +49 -0
- data/spec/poolparty/pool/resources/directory_spec.rb +40 -0
- data/spec/poolparty/pool/resources/exec_spec.rb +37 -0
- data/spec/poolparty/pool/resources/file_spec.rb +40 -0
- data/spec/poolparty/pool/resources/gem_spec.rb +16 -0
- data/spec/poolparty/pool/resources/host_spec.rb +28 -0
- data/spec/poolparty/pool/resources/package_spec.rb +44 -0
- data/spec/poolparty/pool/resources/remote_file_spec.rb +40 -0
- data/spec/poolparty/pool/resources/service_spec.rb +45 -0
- data/spec/poolparty/pool/resources/sshkey_spec.rb +48 -0
- data/spec/poolparty/pool/resources/variable_spec.rb +20 -0
- data/spec/poolparty/pool/script_spec.rb +51 -0
- data/spec/poolparty/pool/test_plugins/sshkey_test +2 -0
- data/{test/test_pool_party.rb → spec/poolparty/pool/test_plugins/virtual_host_template.erb} +0 -0
- data/spec/poolparty/pool/test_plugins/webserver.rb +46 -0
- data/spec/poolparty/poolparty_spec.rb +33 -0
- data/spec/poolparty/spec_helper.rb +120 -0
- data/tasks/cloud.rake +57 -0
- data/tasks/deployment.rake +34 -0
- data/tasks/development.rake +78 -0
- data/tasks/ec2.rake +20 -0
- data/tasks/environment.rake +7 -0
- data/tasks/instance.rake +63 -0
- data/tasks/server.rake +42 -0
- data/tasks/spec.rake +17 -0
- data/tasks/website.rake +17 -0
- data/test/test_generator_helper.rb +29 -0
- data/test/test_helper.rb +2 -0
- data/test/test_pool_spec_generator.rb +47 -0
- data/test/test_poolparty.rb +11 -0
- data/test_manifest.pp +538 -0
- data/website/index.html +107 -0
- data/website/index.txt +95 -0
- data/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/website/stylesheets/code.css +29 -0
- data/website/stylesheets/screen.css +147 -0
- data/website/template.html.erb +49 -0
- metadata +282 -101
- data/CHANGELOG +0 -4
- data/Manifest +0 -55
- data/bin/instance +0 -54
- data/config/config.yml +0 -23
- data/config/create_proxy_ami.sh +0 -582
- data/config/heartbeat_authkeys.conf +0 -2
- data/config/monit.conf +0 -8
- data/config/monit/haproxy.monit.conf +0 -7
- data/config/nginx.conf +0 -24
- data/lib/core/array.rb +0 -10
- data/lib/core/kernel.rb +0 -9
- data/lib/core/object.rb +0 -14
- data/lib/modules/callback.rb +0 -55
- data/lib/modules/ec2_wrapper.rb +0 -74
- data/lib/pool_party.rb +0 -69
- data/lib/pool_party/application.rb +0 -133
- data/lib/pool_party/init.rb +0 -4
- data/lib/pool_party/master.rb +0 -189
- data/lib/pool_party/monitors.rb +0 -13
- data/lib/pool_party/monitors/cpu.rb +0 -18
- data/lib/pool_party/monitors/memory.rb +0 -21
- data/lib/pool_party/monitors/web.rb +0 -18
- data/lib/pool_party/optioner.rb +0 -16
- data/lib/pool_party/os.rb +0 -11
- data/lib/pool_party/os/ubuntu.rb +0 -78
- data/lib/pool_party/remote_instance.rb +0 -180
- data/lib/pool_party/remoting.rb +0 -112
- data/lib/pool_party/scheduler.rb +0 -93
- data/lib/pool_party/tasks.rb +0 -220
- data/lib/s3/s3_object_store_folders.rb +0 -44
- data/spec/application_spec.rb +0 -32
- data/spec/callback_spec.rb +0 -65
- data/spec/helpers/ec2_mock.rb +0 -56
- data/spec/helpers/remote_instance_mock.rb +0 -11
- data/spec/kernel_spec.rb +0 -11
- data/spec/master_spec.rb +0 -147
- data/spec/monitor_spec.rb +0 -16
- data/spec/optioner_spec.rb +0 -22
- data/spec/poolparty_spec.rb +0 -8
- data/spec/remote_instance_spec.rb +0 -29
- data/spec/remoting_spec.rb +0 -75
- data/spec/spec_helper.rb +0 -38
- data/spec/string_spec.rb +0 -28
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
|
+
|
|
3
|
+
include PoolParty::Resources
|
|
4
|
+
|
|
5
|
+
describe "File" do
|
|
6
|
+
before(:each) do
|
|
7
|
+
reset!
|
|
8
|
+
@class = PoolParty::Resources::Classpackage.new({:name => "rockstar"})
|
|
9
|
+
end
|
|
10
|
+
it "should have a method resources" do
|
|
11
|
+
@class.respond_to?(:resources).should == true
|
|
12
|
+
end
|
|
13
|
+
it "should store the resources in an array" do
|
|
14
|
+
@class.resources.class.should == Hash
|
|
15
|
+
end
|
|
16
|
+
describe "with resources" do
|
|
17
|
+
before(:each) do
|
|
18
|
+
cloud :application_cloud do
|
|
19
|
+
classpackage do
|
|
20
|
+
file({:name => "red"})
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
@class = cloud(:application_cloud).resource(:classpackage).first
|
|
24
|
+
end
|
|
25
|
+
it "should store a resource in the resources array" do
|
|
26
|
+
@class.resources.size.should == 1
|
|
27
|
+
end
|
|
28
|
+
it "should have a file resource in the cloud" do
|
|
29
|
+
@class.resource(:file).should_not == nil
|
|
30
|
+
end
|
|
31
|
+
describe "to_s" do
|
|
32
|
+
before(:each) do
|
|
33
|
+
@class.instance_eval do
|
|
34
|
+
name "rockstar"
|
|
35
|
+
file({:name => "red"}) do; end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
it "should output the class with the name as class [name]" do
|
|
39
|
+
@class.to_string.should =~ /class rockstar/
|
|
40
|
+
end
|
|
41
|
+
after do
|
|
42
|
+
@class.to_string
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
describe "setting with a block" do
|
|
48
|
+
before(:each) do
|
|
49
|
+
@class1 = classpackage do
|
|
50
|
+
name "my_class"
|
|
51
|
+
file({:name => "frank"})
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
it "should set the name when set" do
|
|
55
|
+
@class1.name.should == "my_class"
|
|
56
|
+
end
|
|
57
|
+
it "should have the file resource in the resources class" do
|
|
58
|
+
@class1.resources.size.should_not be_zero
|
|
59
|
+
end
|
|
60
|
+
it "should have the file resource in the resources array" do
|
|
61
|
+
@class1.resource(:file).class.should == Array
|
|
62
|
+
end
|
|
63
|
+
it "should store the file in the resources array" do
|
|
64
|
+
@class1.resource(:file).get_named("frank").first.name.should == "frank"
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
describe "from a collection of resources to another" do
|
|
68
|
+
before(:each) do
|
|
69
|
+
self.stub!(:options).and_return({:name => "cook"})
|
|
70
|
+
file(:name => "franksfile")
|
|
71
|
+
exec(:name => "get file", :command => "kill frank for file")
|
|
72
|
+
end
|
|
73
|
+
it "should have the method classpackage_with_self" do
|
|
74
|
+
self.respond_to?(:classpackage_with_self).should == true
|
|
75
|
+
end
|
|
76
|
+
it "should transfer the resources to the class" do
|
|
77
|
+
@class2 = classpackage_with_self(self)
|
|
78
|
+
@class2.resources.should_not be_empty
|
|
79
|
+
end
|
|
80
|
+
it "should leave zero resources on the parent" do
|
|
81
|
+
@class2 = classpackage_with_self(self)
|
|
82
|
+
resources.should be_empty
|
|
83
|
+
end
|
|
84
|
+
end
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
|
+
|
|
3
|
+
include PoolParty::Resources
|
|
4
|
+
|
|
5
|
+
describe "Conditional" do
|
|
6
|
+
before(:each) do
|
|
7
|
+
@cloud = cloud :app do; end
|
|
8
|
+
@cloud.instance_eval do
|
|
9
|
+
execute_if("$hostname", "'master'", self) do
|
|
10
|
+
file({:name => "/etc/apache2/puppetmaster.conf"})
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
@cond = @cloud.resource(:conditional).first
|
|
14
|
+
end
|
|
15
|
+
it "should add the block of resources on the parent" do
|
|
16
|
+
@cloud.resources.size.should == 1
|
|
17
|
+
end
|
|
18
|
+
it "should have a conditional in the resources" do
|
|
19
|
+
@cloud.resource(:conditional).first.name.should == "$hostname == 'master'"
|
|
20
|
+
end
|
|
21
|
+
it "should push the resources onto the conditional resource" do
|
|
22
|
+
@cond.resources.size.should == 1
|
|
23
|
+
end
|
|
24
|
+
it "should have a file resource on the conditional" do
|
|
25
|
+
@cond.resource(:file).first.name.should == "/etc/apache2/puppetmaster.conf"
|
|
26
|
+
end
|
|
27
|
+
it "should have the parent as the cloud" do
|
|
28
|
+
@cond.parent.should == @cloud
|
|
29
|
+
end
|
|
30
|
+
describe "to_string" do
|
|
31
|
+
before(:each) do
|
|
32
|
+
@string = @cond.to_string
|
|
33
|
+
end
|
|
34
|
+
it "should have a case statement for the hostname" do
|
|
35
|
+
@string.should =~ /case \$hostname/
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
|
+
|
|
3
|
+
include PoolParty::Resources
|
|
4
|
+
|
|
5
|
+
describe "Cron" do
|
|
6
|
+
describe "instances" do
|
|
7
|
+
before(:each) do
|
|
8
|
+
@cloud = cloud :cron_resources do
|
|
9
|
+
cron({:command => "/bin/logrotate"})
|
|
10
|
+
end
|
|
11
|
+
@cron = @cloud.resource(:cron).first
|
|
12
|
+
end
|
|
13
|
+
it "should turn the one hash instance into a string" do
|
|
14
|
+
@cron.to_string.should =~ /'\/bin\/logrotate'/
|
|
15
|
+
end
|
|
16
|
+
it "should turn the two hash instance into a string" do
|
|
17
|
+
@cron = cron({:name => "mail", :command => "/bin/mail -s \"letters\""})
|
|
18
|
+
@cron.to_string.should =~ /"mail":/
|
|
19
|
+
end
|
|
20
|
+
describe "as included" do
|
|
21
|
+
before(:each) do
|
|
22
|
+
@cron = cron({:rent => "low"}) do
|
|
23
|
+
name "/www/conf/httpd.conf"
|
|
24
|
+
hour 23
|
|
25
|
+
minute 5
|
|
26
|
+
weekday 1
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
it "should use default values" do
|
|
30
|
+
@cron.name.should == "/www/conf/httpd.conf"
|
|
31
|
+
end
|
|
32
|
+
it "should keep the default values for the file" do
|
|
33
|
+
@cron.user.should == "root"
|
|
34
|
+
end
|
|
35
|
+
it "should also set options through a hash" do
|
|
36
|
+
@cron.rent.should == "low"
|
|
37
|
+
end
|
|
38
|
+
it "should set the hour to 23" do
|
|
39
|
+
@cron.hour.should == 23
|
|
40
|
+
end
|
|
41
|
+
it "should set the minute to 5" do
|
|
42
|
+
@cron.minute.should == 5
|
|
43
|
+
end
|
|
44
|
+
it "should set the weekday to 1" do
|
|
45
|
+
@cron.weekday.should == 1
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
|
+
|
|
3
|
+
include PoolParty::Resources
|
|
4
|
+
|
|
5
|
+
describe "directory" do
|
|
6
|
+
describe "instances" do
|
|
7
|
+
before(:each) do
|
|
8
|
+
@directory = directory({:name => "/etc/apache2/puppetmaster.conf"})
|
|
9
|
+
end
|
|
10
|
+
it "should turn the one hash instance into a string" do
|
|
11
|
+
@directory.to_string.should =~ /"\/etc\/apache2\/puppetmaster\.conf":/
|
|
12
|
+
end
|
|
13
|
+
it "should turn the two hash instance into a string" do
|
|
14
|
+
@directory = directory do
|
|
15
|
+
name "/etc/init.d/puppetmaster"
|
|
16
|
+
owner "redsmith"
|
|
17
|
+
end
|
|
18
|
+
@directory.to_string.should =~ /"\/etc\/init\.d\/puppetmaster":/
|
|
19
|
+
end
|
|
20
|
+
describe "as included" do
|
|
21
|
+
before(:each) do
|
|
22
|
+
@directory = directory({:rent => "low"}) do
|
|
23
|
+
name "/www/conf/httpd.conf"
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
it "should use default values" do
|
|
27
|
+
@directory.name.should == "/www/conf/httpd.conf"
|
|
28
|
+
end
|
|
29
|
+
it "should keep the default values for the directory" do
|
|
30
|
+
@directory.mode.should == 644
|
|
31
|
+
end
|
|
32
|
+
it "should also set options through a hash" do
|
|
33
|
+
@directory.rent.should == "low"
|
|
34
|
+
end
|
|
35
|
+
it "should have ensure set to directory" do
|
|
36
|
+
@directory.ensure.should == "directory"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
|
+
|
|
3
|
+
include PoolParty::Resources
|
|
4
|
+
|
|
5
|
+
describe "Exec" do
|
|
6
|
+
before(:each) do
|
|
7
|
+
@exec = exec({:name => "/usr/bin/ifconfig"})
|
|
8
|
+
end
|
|
9
|
+
describe "instances" do
|
|
10
|
+
it "should turn the one hash instance into a string" do
|
|
11
|
+
@exec.to_string.should =~ /exec \{\n"\/usr\/bin\/ifconfig"/
|
|
12
|
+
end
|
|
13
|
+
it "should turn the two hash instance into a string" do
|
|
14
|
+
@exec = exec({:name => "/usr/bin/ping 127.0.0.1"})
|
|
15
|
+
@exec.to_string.should =~ /"\/usr\/bin\/ping 127\.0\.0\.1":/
|
|
16
|
+
end
|
|
17
|
+
describe "as included" do
|
|
18
|
+
before(:each) do
|
|
19
|
+
@exec = exec({:rent => "low", :ensures => "running"}) do
|
|
20
|
+
name "/www/conf/httpd.conf"
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
it "should use default values" do
|
|
24
|
+
@exec.name.should == "/www/conf/httpd.conf"
|
|
25
|
+
end
|
|
26
|
+
it "should keep the default values for the exec" do
|
|
27
|
+
@exec.path.should =~ /\/usr\/bin:\/bin:\/usr\/local\/bin/
|
|
28
|
+
end
|
|
29
|
+
it "should also set options through a hash" do
|
|
30
|
+
@exec.rent.should == "low"
|
|
31
|
+
end
|
|
32
|
+
it "should ensure running, not the default 'present'" do
|
|
33
|
+
@exec.ensure.should == "running"
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
|
+
|
|
3
|
+
include PoolParty::Resources
|
|
4
|
+
|
|
5
|
+
describe "File" do
|
|
6
|
+
describe "instances" do
|
|
7
|
+
before(:each) do
|
|
8
|
+
@file = file({:name => "/etc/apache2/puppetmaster.conf"})
|
|
9
|
+
end
|
|
10
|
+
it "should turn the one hash instance into a string" do
|
|
11
|
+
@file.to_string.should =~ /"\/etc\/apache2\/puppetmaster\.conf":/
|
|
12
|
+
end
|
|
13
|
+
it "should turn the two hash instance into a string" do
|
|
14
|
+
@file = file do
|
|
15
|
+
name "/etc/init.d/puppetmaster"
|
|
16
|
+
owner "redsmith"
|
|
17
|
+
end
|
|
18
|
+
@file.to_string.should =~ /"\/etc\/init\.d\/puppetmaster":/
|
|
19
|
+
end
|
|
20
|
+
describe "as included" do
|
|
21
|
+
before(:each) do
|
|
22
|
+
@file = file({:rent => "low"}) do
|
|
23
|
+
name "/www/conf/httpd.conf"
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
it "should use default values" do
|
|
27
|
+
@file.name.should == "/www/conf/httpd.conf"
|
|
28
|
+
end
|
|
29
|
+
it "should keep the default values for the file" do
|
|
30
|
+
@file.mode.should == 644
|
|
31
|
+
end
|
|
32
|
+
it "should also set options through a hash" do
|
|
33
|
+
@file.rent.should == "low"
|
|
34
|
+
end
|
|
35
|
+
it "should have ensure set to file" do
|
|
36
|
+
@file.ensure.should == "file"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
|
+
|
|
3
|
+
include PoolParty::Resources
|
|
4
|
+
|
|
5
|
+
describe "Gem" do
|
|
6
|
+
before(:each) do
|
|
7
|
+
reset!
|
|
8
|
+
@gem = gem(:name => "rails")
|
|
9
|
+
end
|
|
10
|
+
it "should have a package" do
|
|
11
|
+
resource(:package).should_not be_empty
|
|
12
|
+
end
|
|
13
|
+
it "should have the 'rails' gem in the packages" do
|
|
14
|
+
@gem.to_string.should =~ /Package\[rubygems\]/
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
|
+
|
|
3
|
+
include PoolParty::Resources
|
|
4
|
+
|
|
5
|
+
describe "Host" do
|
|
6
|
+
describe "instances" do
|
|
7
|
+
before(:each) do
|
|
8
|
+
@host = host({:name => "node1"})
|
|
9
|
+
end
|
|
10
|
+
it "should turn the one hash instance into a string" do
|
|
11
|
+
@host.to_string.should =~ /node1/
|
|
12
|
+
end
|
|
13
|
+
describe "as included" do
|
|
14
|
+
before(:each) do
|
|
15
|
+
@host = host do
|
|
16
|
+
name "master"
|
|
17
|
+
ip "192.168.0.1"
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
it "should use default values" do
|
|
21
|
+
@host.name.should == "master"
|
|
22
|
+
end
|
|
23
|
+
it "should also set options through a hash" do
|
|
24
|
+
@host.ip.should == "192.168.0.1"
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
|
+
|
|
3
|
+
include PoolParty::Resources
|
|
4
|
+
|
|
5
|
+
describe "Package" do
|
|
6
|
+
before(:each) do
|
|
7
|
+
@cloud = cloud :app do;end
|
|
8
|
+
@package = PoolParty::Resources::Package.new({}, @cloud)
|
|
9
|
+
end
|
|
10
|
+
describe "instances" do
|
|
11
|
+
before(:each) do
|
|
12
|
+
@package = package({:name => "/etc/apache2/puppetmaster.conf"})
|
|
13
|
+
end
|
|
14
|
+
it "should turn the one hash instance into a string" do
|
|
15
|
+
@package.to_string.should =~ /"\/etc\/apache2\/puppetmaster\.conf":/
|
|
16
|
+
end
|
|
17
|
+
it "should turn the two hash instance into a string" do
|
|
18
|
+
@package = package({:name => "/etc/init.d/puppetmaster"})
|
|
19
|
+
@package.to_string.should =~ /"\/etc\/init\.d\/puppetmaster":/
|
|
20
|
+
end
|
|
21
|
+
describe "as included" do
|
|
22
|
+
before(:each) do
|
|
23
|
+
@cloud = cloud :included_package do
|
|
24
|
+
package({:rent => "low"}) do
|
|
25
|
+
name "/www/conf/httpd.conf"
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
@package = @cloud.resource(:package).first
|
|
29
|
+
end
|
|
30
|
+
it "should use default values" do
|
|
31
|
+
@package.name.should == "/www/conf/httpd.conf"
|
|
32
|
+
end
|
|
33
|
+
it "should have the cloud as the parent" do
|
|
34
|
+
@package.parent.should == @cloud
|
|
35
|
+
end
|
|
36
|
+
it "should keep the default values for the Package" do
|
|
37
|
+
@package.alias.should == nil
|
|
38
|
+
end
|
|
39
|
+
it "should also set options through a hash" do
|
|
40
|
+
@package.rent.should == "low"
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
|
+
|
|
3
|
+
include PoolParty::Resources
|
|
4
|
+
|
|
5
|
+
describe "Remote file" do
|
|
6
|
+
describe "instances" do
|
|
7
|
+
before(:each) do
|
|
8
|
+
@file = remotefile({:name => "/etc/apache2/puppetmaster.conf"})
|
|
9
|
+
end
|
|
10
|
+
it "should turn the one hash instance into a string" do
|
|
11
|
+
@file.to_string.should =~ /"\/etc\/apache2\/puppetmaster\.conf":/
|
|
12
|
+
end
|
|
13
|
+
it "should turn the two hash instance into a string" do
|
|
14
|
+
@file = file do
|
|
15
|
+
name "/etc/init.d/puppetmaster"
|
|
16
|
+
owner "redsmith"
|
|
17
|
+
end
|
|
18
|
+
@file.to_string.should =~ /"\/etc\/init\.d\/puppetmaster":/
|
|
19
|
+
end
|
|
20
|
+
describe "as included" do
|
|
21
|
+
before(:each) do
|
|
22
|
+
@file = remotefile({:rent => "low"}) do
|
|
23
|
+
name "/www/conf/httpd.conf"
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
it "should have the source set to puppet" do
|
|
27
|
+
@file.source.should == "puppet:///files/httpd.conf"
|
|
28
|
+
end
|
|
29
|
+
it "should use default values" do
|
|
30
|
+
@file.name.should == "/www/conf/httpd.conf"
|
|
31
|
+
end
|
|
32
|
+
it "should keep the default values for the file" do
|
|
33
|
+
@file.mode.should == 644
|
|
34
|
+
end
|
|
35
|
+
it "should also set options through a hash" do
|
|
36
|
+
@file.rent.should == "low"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
|
2
|
+
|
|
3
|
+
include PoolParty::Resources
|
|
4
|
+
|
|
5
|
+
describe "Service" do
|
|
6
|
+
before(:each) do
|
|
7
|
+
reset_resources!
|
|
8
|
+
@service = PoolParty::Resources::Service.new
|
|
9
|
+
end
|
|
10
|
+
describe "instances" do
|
|
11
|
+
before(:each) do
|
|
12
|
+
@service = service({:name => "/etc/apache2/puppetmaster.conf"})
|
|
13
|
+
end
|
|
14
|
+
it "should turn the one hash instance into a string" do
|
|
15
|
+
@service.to_string.should =~ /"\/etc\/apache2\/puppetmaster\.conf":/
|
|
16
|
+
end
|
|
17
|
+
it "should turn the two hash instance into a string" do
|
|
18
|
+
@service = service({:name => "/etc/init.d/puppetmaster"})
|
|
19
|
+
@service.to_string.should =~ /"\/etc\/init\.d\/puppetmaster":/
|
|
20
|
+
end
|
|
21
|
+
describe "as included" do
|
|
22
|
+
before(:each) do
|
|
23
|
+
reset_resources!
|
|
24
|
+
@service = service({:rent => "low", :ensure => "stopped"}) do
|
|
25
|
+
name "mdmdp"
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
it "should use default values" do
|
|
29
|
+
@service.name.should == "mdmdp"
|
|
30
|
+
end
|
|
31
|
+
it "should keep the default values for the Service" do
|
|
32
|
+
@service.enable.should == true
|
|
33
|
+
end
|
|
34
|
+
it "should also set options through a hash" do
|
|
35
|
+
@service.rent.should == "low"
|
|
36
|
+
end
|
|
37
|
+
it "should also set options through a hash" do
|
|
38
|
+
@service.ensure.should == "stopped"
|
|
39
|
+
end
|
|
40
|
+
it "should set ensure as a default if it's not passed" do
|
|
41
|
+
service(:name => "romp").ensure.should == "running"
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|