auser-poolparty 1.2.8 → 1.2.9
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/bin/cloud-list +4 -4
- data/bin/cloud-provision +2 -0
- data/bin/cloud-ssh +1 -1
- data/bin/install-poolparty +1 -1
- data/examples/fairchild.rb +26 -17
- data/examples/metavirt_cloud.rb +2 -4
- data/lib/poolparty.rb +2 -7
- data/lib/poolparty/core/array.rb +1 -1
- data/lib/poolparty/core/exception.rb +1 -1
- data/lib/poolparty/core/hash.rb +12 -5
- data/lib/poolparty/core/integer.rb +11 -0
- data/lib/poolparty/core/object.rb +14 -0
- data/lib/poolparty/core/string.rb +6 -1
- data/lib/poolparty/core/time.rb +6 -0
- data/lib/poolparty/extra/duration.rb +96 -0
- data/lib/poolparty/helpers/binary.rb +1 -1
- data/lib/poolparty/modules/cloud_resourcer.rb +1 -1
- data/lib/poolparty/modules/definable_resource.rb +5 -7
- data/lib/poolparty/modules/output.rb +2 -2
- data/lib/poolparty/monitors/base_monitor.rb +17 -0
- data/lib/poolparty/net/init.rb +4 -11
- data/lib/poolparty/net/remote_instance.rb +5 -0
- data/lib/poolparty/net/remoter/connections.rb +14 -11
- data/lib/poolparty/net/remoter/interactive.rb +13 -2
- data/lib/poolparty/net/remoter_base.rb +9 -4
- data/lib/poolparty/net/remoter_bases/ec2/ec2.rb +50 -35
- data/lib/poolparty/net/remoter_bases/ec2/ec2_remote_instance.rb +46 -5
- data/lib/poolparty/net/remoter_bases/ec2/ec2_response_object.rb +57 -1
- data/lib/poolparty/plugins/apache2/apache.rb +13 -160
- data/lib/poolparty/plugins/apache2/passenger_site.rb +86 -0
- data/lib/poolparty/plugins/apache2/php5.rb +40 -0
- data/lib/poolparty/plugins/apache2/virtual_host.rb +53 -0
- data/lib/poolparty/plugins/authorized_key.rb +2 -2
- data/lib/poolparty/plugins/bind.rb +5 -6
- data/lib/poolparty/plugins/{chef.rb → chef/chef.rb} +22 -18
- data/lib/poolparty/plugins/{chef_deploy.rb → chef/chef_deploy.rb} +20 -19
- data/lib/poolparty/plugins/deploy_directory.rb +2 -3
- data/lib/poolparty/plugins/gem_package.rb +6 -12
- data/lib/poolparty/plugins/git.rb +22 -7
- data/lib/poolparty/{base_packages → plugins}/haproxy.rb +2 -2
- data/lib/poolparty/{base_packages → plugins}/heartbeat.rb +7 -7
- data/lib/poolparty/plugins/line_in_file.rb +4 -2
- data/lib/poolparty/plugins/plugin_template.rb +13 -0
- data/lib/poolparty/{base_packages/poolparty.rb → plugins/poolparty_base_packages.rb} +2 -2
- data/lib/poolparty/plugins/rails_deploy.rb +2 -3
- data/lib/poolparty/{base_packages → plugins}/ruby.rb +3 -3
- data/lib/poolparty/{base_packages → plugins}/runit.rb +3 -3
- data/lib/poolparty/plugins/svn.rb +8 -6
- data/lib/poolparty/poolparty/cloud.rb +5 -8
- data/lib/poolparty/poolparty/default.rb +1 -1
- data/lib/poolparty/poolparty/plugin.rb +36 -15
- data/lib/poolparty/poolparty/pool.rb +6 -2
- data/lib/poolparty/poolparty/poolparty_base_class.rb +5 -11
- data/lib/poolparty/poolparty/resource.rb +2 -1
- data/lib/poolparty/poolparty/service.rb +6 -8
- data/lib/poolparty/provision/dr_configure.rb +3 -3
- data/lib/poolparty/verification/verifier_base.rb +10 -0
- data/spec/bin/server-list-active_spec.rb +1 -3
- data/spec/poolparty/core/string_spec.rb +1 -1
- data/spec/poolparty/dependency_resolver/chef_resolver_spec.rb +0 -2
- data/spec/poolparty/dependency_resolver/dependency_resolver_cloud_extensions_spec.rb +16 -13
- data/spec/poolparty/extra/deployments_spec.rb +68 -68
- data/spec/poolparty/net/remoter_bases/ec2_spec.rb +1 -0
- data/spec/poolparty/plugins/deploydirectory_spec.rb +64 -51
- data/spec/poolparty/poolparty/cloud_spec.rb +21 -19
- data/spec/poolparty/poolparty/configurers/files/ruby_basic.rb +1 -1
- data/spec/poolparty/poolparty/configurers/files/ruby_plugins.rb +1 -1
- data/spec/poolparty/{base_packages → poolparty}/haproxy_spec.rb +1 -1
- data/spec/poolparty/{base_packages → poolparty}/heartbeat_spec.rb +1 -1
- data/spec/poolparty/poolparty/plugin_model_spec.rb +6 -13
- data/spec/poolparty/poolparty/plugin_spec.rb +7 -7
- data/spec/poolparty/poolparty/resource_spec.rb +15 -5
- data/spec/poolparty/poolparty/test_plugins/webserver.rb +27 -23
- data/test/fixtures/metavirt_cloud.json +1 -0
- data/test/poolparty/dependency_resolver/puppet_resolver_test.rb +0 -5
- data/test/poolparty/modules/cloud_dsl_test.rb +1 -1
- data/test/poolparty/monitors/test_base_monitor.rb +17 -0
- data/test/poolparty/monitors/test_monitor_rack.rb +39 -0
- data/test/poolparty/net/remoter_base_test.rb +18 -0
- data/test/poolparty/plugins/chef_deploy_test.rb +1 -1
- data/test/poolparty/plugins/rails_deploy_test.rb +3 -3
- data/test/poolparty/poolparty/cloud_test.rb +27 -2
- data/test/poolparty/poolparty/isolated_cloud_test.rb +25 -0
- data/test/poolparty/poolparty/plugin_test.rb +9 -8
- data/test/poolparty/poolparty/schema_test.rb +13 -0
- data/test/poolparty/verification/verify_test.rb +4 -0
- data/test/test_helper.rb +10 -3
- data/test/test_methods.rb +11 -0
- data/vendor/gems/dslify/test/dslify_test.rb +28 -0
- metadata +29 -15
- data/lib/poolparty/extra/deployments.rb +0 -31
- data/lib/poolparty/poolparty/plugin_model.rb +0 -46
@@ -1,9 +1,19 @@
|
|
1
1
|
module PoolParty
|
2
2
|
module Verifiers
|
3
|
+
@available_verifiers =[]
|
4
|
+
def self.available
|
5
|
+
@available_verifiers
|
6
|
+
end
|
3
7
|
|
4
8
|
class VerifierBase
|
5
9
|
attr_reader :host
|
6
10
|
|
11
|
+
def self.inherited(subclass)
|
12
|
+
unless Verifiers.available.include?(subclass)
|
13
|
+
Verifiers.available << subclass
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
7
17
|
def host=(h=nil)
|
8
18
|
@host ||= h
|
9
19
|
end
|
@@ -2,14 +2,12 @@ require File.dirname(__FILE__) + '/bin_spec_helper'
|
|
2
2
|
require "poolparty"
|
3
3
|
|
4
4
|
class PuppetResolverSpec
|
5
|
-
plugin :apache do
|
6
|
-
end
|
7
5
|
end
|
8
6
|
|
9
7
|
describe "Server list active binary" do
|
10
8
|
describe "with real cloud" do
|
11
9
|
before(:each) do
|
12
|
-
|
10
|
+
::PoolParty::Plugin::Haproxy.stub!(:new).and_return nil
|
13
11
|
$pool_specfile = __FILE__
|
14
12
|
@p = PoolParty::Pool::Pool.load_from_file "#{::File.dirname(__FILE__)}/fixtures/bin_cloud_for_test.rb"
|
15
13
|
@pool_hash = @p.to_properties_hash
|
@@ -72,7 +72,7 @@ listen web_proxy 127.0.0.1:3000
|
|
72
72
|
@str = "prok"
|
73
73
|
end
|
74
74
|
it "should be able to turn itself into constant" do
|
75
|
-
@str.class_constant.should ==
|
75
|
+
@str.class_constant.should == PoolPartyProk
|
76
76
|
end
|
77
77
|
it "should turn itself into a class constant" do
|
78
78
|
@str.class_constant.class.should == Class
|
@@ -22,15 +22,15 @@ class DependencyResolverSpecTestCloud < DependencyResolverCloudExtensionsSpecBas
|
|
22
22
|
dsl_methods :keypair, :name
|
23
23
|
end
|
24
24
|
|
25
|
-
class JunkClassForDefiningPlugin
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
end
|
25
|
+
# class JunkClassForDefiningPlugin
|
26
|
+
# apache_plugin do
|
27
|
+
# default_options(
|
28
|
+
# :listen => 80
|
29
|
+
# )
|
30
|
+
# def loaded(o={},&block)
|
31
|
+
# end
|
32
|
+
# end
|
33
|
+
# end
|
34
34
|
|
35
35
|
describe "Resolution spec" do
|
36
36
|
before(:each) do
|
@@ -84,7 +84,7 @@ describe "Resolution spec" do
|
|
84
84
|
before(:each) do
|
85
85
|
reset!
|
86
86
|
::File.stub!(:basename).and_return "template"
|
87
|
-
@file = "Hello <%= friends %> on port <%=
|
87
|
+
@file = "Hello <%= friends %> on port <%= port %>"
|
88
88
|
@file.stub!(:read).and_return @file
|
89
89
|
Template.stub!(:open).and_return @file
|
90
90
|
|
@@ -95,11 +95,14 @@ describe "Resolution spec" do
|
|
95
95
|
has_directory :name => "/var/www"
|
96
96
|
has_package :name => "bash"
|
97
97
|
# parent == nil
|
98
|
-
|
98
|
+
apache do
|
99
99
|
# parent == TestClass
|
100
100
|
# puts "<pre>#{parent}</pre> on <pre>#{context_stack.map {|a| a.class }.join(", ")} from #{self.class}</pre>"
|
101
101
|
listen "8080"
|
102
|
-
has_file :name => "/etc/apache2/apache2.conf",
|
102
|
+
has_file :name => "/etc/apache2/apache2.conf",
|
103
|
+
:template => "/absolute/path/to/template",
|
104
|
+
:friends => "bob",
|
105
|
+
:render_as => :erb
|
103
106
|
end
|
104
107
|
end
|
105
108
|
@cloud = clouds[:dog_for_test]
|
@@ -115,7 +118,7 @@ describe "Resolution spec" do
|
|
115
118
|
@properties[:resources].class.should == Array
|
116
119
|
end
|
117
120
|
it "contain content in the template's hash" do
|
118
|
-
@apache_key.resources.select_with_hash(:pp_type => "file").
|
121
|
+
@apache_key.resources.select_with_hash(:pp_type => "file").first[:content].should == "Hello bob on port 8080"
|
119
122
|
end
|
120
123
|
it "contain the files in a hash" do
|
121
124
|
# puts "<pre>#{@properties.to_yaml}</pre>"
|
@@ -1,68 +1,68 @@
|
|
1
|
-
#TODO: Reimplement
|
2
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
3
|
-
|
4
|
-
describe "deployments" do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
end
|
1
|
+
# #TODO: Reimplement
|
2
|
+
# require File.dirname(__FILE__) + '/../spec_helper'
|
3
|
+
#
|
4
|
+
# describe "deployments" do
|
5
|
+
# describe "class" do
|
6
|
+
# before(:each) do
|
7
|
+
# @klass = PoolParty::Extra::Deployments
|
8
|
+
# @file = "hanky_danky_ranky.pool"
|
9
|
+
# ::File.stub!(:file?).with(@file).and_return false
|
10
|
+
# end
|
11
|
+
# it "should have the singleton method include_deployment" do
|
12
|
+
# @klass.respond_to?(:include_deployment).should == true
|
13
|
+
# end
|
14
|
+
# it "should return nil if the file doesn't exist" do
|
15
|
+
# @klass.include_deployment(@file).should == nil
|
16
|
+
# end
|
17
|
+
# describe "existing file" do
|
18
|
+
# before(:each) do
|
19
|
+
# ::File.stub!(:file?).and_return true
|
20
|
+
# @contents = "'hello goober'"
|
21
|
+
# @klass.stub!(:open).with(@file).and_return @file
|
22
|
+
# @file.stub!(:read).and_return @contents
|
23
|
+
# @klass.include_deployment(@file).should_not == nil
|
24
|
+
# end
|
25
|
+
# it "should not be nil if the file does exist" do
|
26
|
+
# @klass.include_deployment(@file).should_not == nil
|
27
|
+
# end
|
28
|
+
# it "should create a class called PoolPartyHankyDankyRankyClass" do
|
29
|
+
# @klass.include_deployment(@file).nil?.should == false
|
30
|
+
# Object.const_defined?(Plugin::HankyDankyRanky).should == true
|
31
|
+
# end
|
32
|
+
# it "should create a method on the class called enable" do
|
33
|
+
# HankyDankyRanky.new.respond_to?(:enable).should == true
|
34
|
+
# end
|
35
|
+
# it "should add the contents of the file to be eval'd on the method" do
|
36
|
+
# # puts HankyDankyRankyClass.new.enable
|
37
|
+
# # HankyDankyRankyClass.new.enable.should == "hello goober"
|
38
|
+
# pending
|
39
|
+
# end
|
40
|
+
# end
|
41
|
+
# describe "include_deployments" do
|
42
|
+
# before(:each) do
|
43
|
+
# ::File.stub!(:directory?).and_return false
|
44
|
+
# @dir = "/deployments"
|
45
|
+
# end
|
46
|
+
# it "should have the method include_deployments" do
|
47
|
+
# @klass.respond_to?(:include_deployments).should == true
|
48
|
+
# end
|
49
|
+
# it "should return nil if the directory does not exist" do
|
50
|
+
# @klass.include_deployments(@dir).should == nil
|
51
|
+
# end
|
52
|
+
# describe "existing directory" do
|
53
|
+
# before(:each) do
|
54
|
+
# ::File.stub!(:directory?).and_return true
|
55
|
+
# @contents = []
|
56
|
+
# Dir.stub!(:[]).and_return @contents
|
57
|
+
# end
|
58
|
+
# it "should not be nil if the directory exists" do
|
59
|
+
# @klass.include_deployments(@dir).nil?.should == false
|
60
|
+
# end
|
61
|
+
# it "should call Dir.[] on the directory" do
|
62
|
+
# Dir.should_receive(:[]).with("#{@dir}/*").and_return []
|
63
|
+
# @klass.include_deployments(@dir)
|
64
|
+
# end
|
65
|
+
# end
|
66
|
+
# end
|
67
|
+
# end
|
68
|
+
# end
|
@@ -1,51 +1,64 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
class TestDeployDirectoryClass < PoolParty::Cloud::Cloud
|
4
|
+
end
|
5
|
+
|
6
|
+
describe "Remote Instance" do
|
7
|
+
describe "wrapped" do
|
8
|
+
before(:each) do
|
9
|
+
reset!
|
10
|
+
@tc = cloud :test_deploy_directory_class_cloud do
|
11
|
+
has_deploy_directory("map-experiments",
|
12
|
+
:from => "~/projects/westfield/map-experiments",
|
13
|
+
:to => "/var/www/wifi-maps",
|
14
|
+
:mode => "755",
|
15
|
+
:owner => "www-data")
|
16
|
+
|
17
|
+
has_deploy_directory("map-experiments-two",
|
18
|
+
:from => "~/projects/westfield/map-experiments",
|
19
|
+
:to => "/var/www/wifi-maps-two",
|
20
|
+
:mode => "755",
|
21
|
+
:owner => "www-data")
|
22
|
+
|
23
|
+
end
|
24
|
+
@compiled = ChefResolver.new(@tc.to_properties_hash).compile
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "when being listed the first time" do
|
28
|
+
it "should be a string" do
|
29
|
+
@compiled.should =~ /execute/
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should create the directory specified in 'to'" do
|
33
|
+
@compiled.should =~ %r{directory "/var/www/wifi-maps"}
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should copy from the deploy directory" do
|
37
|
+
#@compiled.should =~ %r{command "cp \-R /var/poolparty/dr_configure/user_directory/map-experiments/map-experiments/\* /var/www/wifi-maps"}
|
38
|
+
@compiled.should =~ %r{command "cp \-R /var/poolparty/dr_configure/user_directory/map-experiments/\* /var/www/wifi-maps"}
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should chown if needed" do
|
42
|
+
@compiled.should =~ %r{command "chown www-data \-R /var/www/wifi-maps"}
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should chmod if needed" do
|
46
|
+
@compiled.should =~ %r{command "chmod 755 /var/www/wifi-maps"}
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "when being listed a second time with the same source" do
|
51
|
+
it "should create the directory specified in 'to'" do
|
52
|
+
@compiled.should =~ %r{directory "/var/www/wifi-maps-two"}
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should copy from the right deploy directory" do
|
56
|
+
#@compiled.should =~ %r{command "cp \-R /var/poolparty/dr_configure/user_directory/map-experiments-two/map-experiments/\* /var/www/wifi-maps-two"}
|
57
|
+
@compiled.should =~ %r{command "cp \-R /var/poolparty/dr_configure/user_directory/map-experiments/\* /var/www/wifi-maps-two"}
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# it should be able to have a different name and from
|
@@ -1,13 +1,15 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../spec_helper'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
3
|
+
module PoolParty
|
4
|
+
module Plugin
|
5
|
+
class TestService < Plugin
|
6
|
+
def initialize(o={}, e=nil, &block)
|
7
|
+
super(&block)
|
8
|
+
end
|
9
|
+
def enable(o={})
|
10
|
+
has_file(:name => "/etc/poolparty/lobos")
|
11
|
+
end
|
12
|
+
end
|
11
13
|
end
|
12
14
|
end
|
13
15
|
|
@@ -214,14 +216,14 @@ describe "Cloud" do
|
|
214
216
|
@cloud.instance_eval do
|
215
217
|
@heartbeat = nil
|
216
218
|
end
|
217
|
-
@hb =
|
219
|
+
@hb = PoolParty::Plugin::Heartbeat.new
|
218
220
|
end
|
219
221
|
it "should call enable on the plugin call" do
|
220
|
-
@hb =
|
221
|
-
|
222
|
+
@hb = PoolParty::Plugin::Heartbeat.new
|
223
|
+
PoolParty::Plugin::Heartbeat.stub!(:new).and_return @hb
|
222
224
|
|
223
225
|
@cloud.send :add_poolparty_base_requirements
|
224
|
-
@cloud.
|
226
|
+
@cloud.heartbeat.should == @hb
|
225
227
|
end
|
226
228
|
describe "after adding" do
|
227
229
|
before(:each) do
|
@@ -231,22 +233,22 @@ describe "Cloud" do
|
|
231
233
|
describe "resources" do
|
232
234
|
before(:each) do
|
233
235
|
reset!
|
234
|
-
|
236
|
+
cloud :tester do
|
235
237
|
test_service
|
236
238
|
end
|
237
|
-
@service = clouds[:tester].ordered_resources.select {|hsh|
|
239
|
+
@service = clouds[:tester].ordered_resources.select {|hsh|
|
240
|
+
hsh.to_properties_hash.name == "test_service"
|
241
|
+
}.first
|
238
242
|
@files = @service.resource(:file)
|
239
243
|
end
|
240
244
|
it "should have a file resource" do
|
241
|
-
|
242
|
-
pending
|
245
|
+
@files.first.nil?.should == false
|
243
246
|
end
|
244
247
|
it "should have an array of lines" do
|
245
248
|
@files.class.should == Array
|
246
249
|
end
|
247
|
-
it "should
|
248
|
-
|
249
|
-
pending
|
250
|
+
it "should have the file /etc/poolparty/lobos" do
|
251
|
+
@files.first.name.should == "/etc/poolparty/lobos"
|
250
252
|
end
|
251
253
|
end
|
252
254
|
end
|