auser-poolparty 1.2.10 → 1.2.11
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 +1 -1
- data/bin/cloud-list +19 -7
- data/bin/cloud-provision +3 -0
- data/bin/cloud-run +37 -0
- data/bin/server-list-active +1 -1
- data/config/jeweler.rb +2 -2
- data/examples/basic.rb +4 -3
- data/examples/fairchild.rb +2 -2
- data/examples/metavirt_cloud.rb +18 -8
- data/examples/simple.rb +4 -3
- data/examples/vmrun_cloud.rb +2 -5
- data/lib/poolparty.rb +1 -1
- data/lib/poolparty/core/object.rb +6 -4
- data/lib/poolparty/core/string.rb +2 -1
- data/lib/poolparty/helpers/optioner.rb +1 -1
- data/lib/poolparty/modules/callbacks.rb +2 -0
- data/lib/poolparty/modules/cloud_resourcer.rb +4 -5
- data/lib/poolparty/modules/daemonizable.rb +4 -5
- data/lib/poolparty/modules/definable_resource.rb +1 -0
- data/lib/poolparty/modules/pinger.rb +5 -1
- data/lib/poolparty/monitors/monitor_daemon.rb +159 -0
- data/lib/poolparty/monitors/monitor_rack.rb +21 -11
- data/lib/poolparty/monitors/monitors/clock_monitor.rb +5 -0
- data/lib/poolparty/monitors/monitors/elections_monitor.rb +49 -0
- data/lib/poolparty/monitors/monitors/neighborhood_monitor.rb +7 -7
- data/lib/poolparty/monitors/monitors/stats_monitor.rb +15 -3
- data/lib/poolparty/net/init.rb +1 -1
- data/lib/poolparty/net/remote_instance.rb +43 -39
- data/lib/poolparty/net/remoter/connections.rb +6 -3
- data/lib/poolparty/net/remoter/interactive.rb +18 -11
- data/lib/poolparty/net/remoter_base.rb +39 -12
- data/lib/poolparty/net/remoter_bases/ec2/ec2.rb +23 -19
- data/lib/poolparty/net/remoter_bases/ec2/ec2_remote_instance.rb +15 -33
- data/lib/poolparty/net/remoter_bases/ec2/ec2_response_object.rb +28 -20
- data/lib/poolparty/net/remoter_bases/libvirt/libvirt.rb +73 -0
- data/lib/poolparty/net/remoter_bases/libvirt/libvirt_instance.rb +64 -0
- data/lib/poolparty/net/remoter_bases/metavirt/metavirt.rb +27 -17
- data/lib/poolparty/net/remoter_bases/metavirt/metavirt_instance.rb +20 -35
- data/lib/poolparty/net/remoter_bases/vmrun/vmrun.rb +35 -17
- data/lib/poolparty/net/remoter_bases/vmrun/vmrun_instance.rb +32 -24
- data/lib/poolparty/plugins/apache2/apache.rb +1 -1
- data/lib/poolparty/plugins/chef/chef.rb +12 -26
- data/lib/poolparty/plugins/chef/chef_deploy.rb +5 -23
- data/lib/poolparty/plugins/chef/chef_deploy_definition.rb +32 -0
- data/lib/poolparty/plugins/chef/chef_library.rb +7 -0
- data/lib/poolparty/plugins/chef/chef_recipe.rb +7 -0
- data/lib/poolparty/plugins/chef/include_chef_recipe.rb +14 -0
- data/lib/poolparty/{resources → plugins}/host.rb +5 -4
- data/lib/poolparty/plugins/line_in_file.rb +1 -1
- data/lib/poolparty/{resources → plugins}/sshkey.rb +10 -8
- data/lib/poolparty/poolparty/cloud.rb +7 -0
- data/lib/poolparty/poolparty/default.rb +0 -2
- data/lib/poolparty/poolparty/pool.rb +13 -3
- data/lib/poolparty/provision/boot_strapper.rb +8 -8
- data/lib/poolparty/resources/exec.rb +7 -0
- data/lib/poolparty/resources/group.rb +3 -3
- data/lib/poolparty/resources/user.rb +6 -1
- data/lib/poolparty/templates/monitor.ru +12 -0
- data/spec/poolparty/net/remoter_bases/ec2_remote_instance_spec.rb +0 -2
- data/spec/poolparty/net/remoter_bases/ec2_spec.rb +7 -4
- data/spec/poolparty/poolparty/example_spec.rb +21 -21
- data/spec/poolparty/poolparty/pool_spec.rb +2 -1
- data/spec/poolparty/resources/sshkey_spec.rb +39 -40
- data/tasks/poolparty.rake +27 -1
- data/test/fixtures/fake_clouds.rb +11 -0
- data/test/poolparty/dependency_resolver/chef_resolver_test.rb +82 -0
- data/test/poolparty/monitors/test_base_monitor.rb +2 -2
- data/test/poolparty/monitors/test_monitor_rack.rb +11 -24
- data/test/poolparty/net/remoter_base_test.rb +4 -5
- data/test/poolparty/net/remoter_bases/libvirt/libvirt_test.rb +70 -0
- data/test/poolparty/net/remoter_bases/metavirt/metavirt_test.rb +32 -3
- data/test/poolparty/plugins/chef_plugin_test.rb +23 -0
- data/test/poolparty/poolparty/pool_test.rb +22 -0
- data/vendor/gems/dslify/lib/dslify.rb +3 -0
- data/vendor/gems/dslify/test/dslify_test.rb +4 -15
- data/vendor/gems/git-style-binaries/README.markdown +6 -0
- data/vendor/gems/git-style-binaries/Rakefile +1 -1
- data/vendor/gems/git-style-binaries/VERSION.yml +1 -1
- data/vendor/gems/git-style-binaries/doc/gsb-screencast.png +0 -0
- data/vendor/gems/git-style-binaries/doc/poolparty-binaries.screenplay +11 -13
- data/vendor/gems/git-style-binaries/git-style-binaries.gemspec +12 -3
- data/vendor/gems/git-style-binaries/lib/git-style-binary.rb +15 -1
- data/vendor/gems/git-style-binaries/test/running_binaries_test.rb +2 -2
- data/vendor/gems/suitcase/VERSION.yml +1 -1
- data/vendor/gems/suitcase/lib/suitcase/zipper.rb +73 -25
- data/vendor/gems/suitcase/suitcase.gemspec +5 -5
- data/vendor/gems/suitcase/test/suitcase_test.rb +12 -6
- data/vendor/gems/suitcase/test/test_dir/gems/famoseagle-carrot-0.6.0.gem +0 -0
- metadata +24 -52
- data/spec/poolparty/resources/host_spec.rb +0 -35
- data/vendor/gems/rest-client/README.rdoc +0 -151
- data/vendor/gems/rest-client/Rakefile +0 -85
- data/vendor/gems/rest-client/bin/restclient +0 -87
- data/vendor/gems/rest-client/lib/rest_client.rb +0 -2
- data/vendor/gems/rest-client/lib/restclient.rb +0 -93
- data/vendor/gems/rest-client/lib/restclient/exceptions.rb +0 -84
- data/vendor/gems/rest-client/lib/restclient/mixin/response.rb +0 -43
- data/vendor/gems/rest-client/lib/restclient/raw_response.rb +0 -30
- data/vendor/gems/rest-client/lib/restclient/request.rb +0 -232
- data/vendor/gems/rest-client/lib/restclient/resource.rb +0 -146
- data/vendor/gems/rest-client/lib/restclient/response.rb +0 -20
- data/vendor/gems/rest-client/rest-client.gemspec +0 -21
- data/vendor/gems/rest-client/spec/base.rb +0 -4
- data/vendor/gems/rest-client/spec/exceptions_spec.rb +0 -54
- data/vendor/gems/rest-client/spec/mixin/response_spec.rb +0 -46
- data/vendor/gems/rest-client/spec/raw_response_spec.rb +0 -17
- data/vendor/gems/rest-client/spec/request_spec.rb +0 -442
- data/vendor/gems/rest-client/spec/resource_spec.rb +0 -75
- data/vendor/gems/rest-client/spec/response_spec.rb +0 -16
- data/vendor/gems/rest-client/spec/restclient_spec.rb +0 -53
@@ -1,5 +1,5 @@
|
|
1
1
|
module PoolParty
|
2
|
-
module
|
2
|
+
module Plugin
|
3
3
|
=begin rdoc
|
4
4
|
|
5
5
|
== Host
|
@@ -22,14 +22,15 @@ The host parameter sets hosts on the instances. Setting this, every node will ha
|
|
22
22
|
|
23
23
|
has_host({:name => "other_machine", :ip => 192.168.0.101 })
|
24
24
|
=end
|
25
|
-
class Host <
|
25
|
+
class Host < Plugin
|
26
26
|
|
27
27
|
default_options({
|
28
|
+
:name => "localhost",
|
28
29
|
:ip => "127.0.0.1"
|
29
30
|
})
|
30
31
|
|
31
|
-
def
|
32
|
-
|
32
|
+
def loaded(o={},&block)
|
33
|
+
has_line_in_file(:file => "/etc/hosts", :line => "#{o[:ip]} #{o[:name]}")
|
33
34
|
end
|
34
35
|
|
35
36
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module PoolParty
|
2
|
-
module
|
2
|
+
module Plugin
|
3
3
|
=begin rdoc
|
4
4
|
|
5
5
|
== Ssh Key
|
@@ -16,30 +16,32 @@ The sshkey resource specifies an ssh key that should be distributed on all the n
|
|
16
16
|
== Options
|
17
17
|
|
18
18
|
* <tt>key</tt> The key content for the ssh key
|
19
|
-
* <tt>
|
19
|
+
* <tt>name</tt> The location of the ssh key
|
20
20
|
|
21
21
|
== Examples
|
22
22
|
|
23
|
-
has_sshkey(:key => "ABIGLONGSTRINGOFDIGETS", :
|
23
|
+
has_sshkey(:key => "ABIGLONGSTRINGOFDIGETS", :name => "/root/.ssh/key_file")
|
24
24
|
=end
|
25
25
|
|
26
|
-
class Sshkey <
|
26
|
+
class Sshkey < Plugin
|
27
27
|
|
28
28
|
dsl_methods(:key,
|
29
29
|
:keypath,
|
30
30
|
:name)
|
31
31
|
|
32
|
-
default_options(:type => 'rsa')
|
32
|
+
default_options(:type => 'rsa', :mode => "600")
|
33
33
|
|
34
34
|
def initialize(opts={}, extra_opts={}, &block)
|
35
35
|
super(opts, extra_opts, &block)
|
36
36
|
@key = Key.new(keypath ? keypath : nil)
|
37
37
|
self.key = @key.content
|
38
38
|
end
|
39
|
-
|
40
|
-
def
|
41
|
-
|
39
|
+
|
40
|
+
def loaded(opts={}, &block)
|
41
|
+
has_directory(::File.dirname(opts[:name]))
|
42
|
+
has_file(:name => opts[:name], :content => self.key, :mode => opts[:mode])
|
42
43
|
end
|
44
|
+
|
43
45
|
|
44
46
|
end
|
45
47
|
|
@@ -83,6 +83,7 @@ module PoolParty
|
|
83
83
|
|
84
84
|
additional_callbacks [
|
85
85
|
"after_launch_instance",
|
86
|
+
"before_provision",
|
86
87
|
"after_provision"
|
87
88
|
]
|
88
89
|
|
@@ -352,6 +353,12 @@ module PoolParty
|
|
352
353
|
def after_bootstrap
|
353
354
|
after_blocks[:bootstrap].each {|b| b.call(self) } if after_blocks.has_key?(:bootstrap)
|
354
355
|
end
|
356
|
+
def before_provision
|
357
|
+
before_blocks[:provision].each {|b| b.call(self) } if before_blocks.has_key?(:provision)
|
358
|
+
end
|
359
|
+
def after_provision
|
360
|
+
after_blocks[:provision].each {|b| b.call(self) } if after_blocks.has_key?(:provision)
|
361
|
+
end
|
355
362
|
def before_configure
|
356
363
|
before_blocks[:configure].each {|b| b.call(self) } if before_blocks.has_key?(:configure)
|
357
364
|
end
|
@@ -51,10 +51,20 @@ module PoolParty
|
|
51
51
|
#%w(monitors plugins verifiers).each do |lib|
|
52
52
|
# Dir[File.join(::File.dirname(::File.basename(filename)), lib, '*')].each{|f| require f }
|
53
53
|
# end
|
54
|
-
File.open(filename, 'r') do |f|
|
55
|
-
instance_eval f.read, pool_specfile
|
54
|
+
o = File.open(filename, 'r') do |f|
|
55
|
+
instance_eval f.read, (pool_specfile || filename)
|
56
56
|
end
|
57
|
-
|
57
|
+
o.call_after_all_loaded if o.respond_to?(:call_after_all_loaded)
|
58
|
+
o
|
59
|
+
end
|
60
|
+
|
61
|
+
# callback
|
62
|
+
def after_all_loaded(&block)
|
63
|
+
@after_all_loaded ||= block
|
64
|
+
end
|
65
|
+
|
66
|
+
def call_after_all_loaded
|
67
|
+
after_all_loaded.call if after_all_loaded
|
58
68
|
end
|
59
69
|
|
60
70
|
def name(*args)
|
@@ -27,12 +27,11 @@ module PoolParty
|
|
27
27
|
lockfile
|
28
28
|
rubigen
|
29
29
|
json
|
30
|
-
activesupport
|
31
30
|
grempe-amazon-ec2
|
32
31
|
ohai
|
33
32
|
chef
|
34
33
|
ruby-openid
|
35
|
-
|
34
|
+
auser-rest-client
|
36
35
|
rack
|
37
36
|
thin
|
38
37
|
logging
|
@@ -91,7 +90,7 @@ module PoolParty
|
|
91
90
|
::Suitcase::Zipper.add_content_as(Default.keys_in_yaml, "ppkeys", "keys")
|
92
91
|
|
93
92
|
edge_pp_gem = Dir["#{Default.vendor_path}/../pkg/*poolparty*gem"].pop
|
94
|
-
# Use the locally built poolparty gem if it is
|
93
|
+
# Use the locally built poolparty gem if it is available
|
95
94
|
if edge_pp_gem
|
96
95
|
puts "using edge poolparty: #{::File.expand_path(edge_pp_gem)}"
|
97
96
|
::Suitcase::Zipper.add(edge_pp_gem, 'gems')
|
@@ -101,9 +100,9 @@ module PoolParty
|
|
101
100
|
end
|
102
101
|
# Add the gems to the suitcase
|
103
102
|
puts "Adding default gem dependencies"
|
104
|
-
::Suitcase::Zipper.gems self.class.gem_list, "#{cloud.tmp_path}/trash/dependencies"
|
103
|
+
::Suitcase::Zipper.gems self.class.gem_list, :gem_location => "#{cloud.tmp_path}/trash/dependencies", :search_paths => ["#{Default.vendor_path}/../pkg"]
|
105
104
|
|
106
|
-
::Suitcase::Zipper.packages( "http://rubyforge.org/frs/download.php/
|
105
|
+
::Suitcase::Zipper.packages( "http://rubyforge.org/frs/download.php/57643/rubygems-1.3.4.tgz",
|
107
106
|
"#{cloud.tmp_path}/trash/dependencies/packages")
|
108
107
|
# ::Suitcase::Zipper.add("templates/")
|
109
108
|
|
@@ -141,9 +140,9 @@ module PoolParty
|
|
141
140
|
'cd /var/poolparty/dependencies',
|
142
141
|
"cp /var/poolparty/dependencies/etc/poolparty/gemrc_template /etc/poolparty",
|
143
142
|
"#{installer} update",
|
144
|
-
"#{installer} install -y ruby ruby1.8-dev libopenssl-ruby1.8 build-essential wget", #optional, but nice to have
|
145
|
-
"tar -zxvf packages/rubygems-1.3.
|
146
|
-
"cd rubygems-1.3.
|
143
|
+
"#{installer} install -y ruby ruby1.8-dev irb libopenssl-ruby1.8 build-essential wget", #optional, but nice to have
|
144
|
+
"tar -zxvf packages/rubygems-1.3.4.tgz",
|
145
|
+
"cd rubygems-1.3.4",
|
147
146
|
"ruby setup.rb --no-ri --no-rdoc",
|
148
147
|
"ln -sfv /usr/bin/gem1.8 /usr/bin/gem", #TODO: check if this is really needed
|
149
148
|
"cd ../ && rm -rf rubygems-1.3.1*",
|
@@ -160,6 +159,7 @@ module PoolParty
|
|
160
159
|
# "god -c /etc/poolparty/monitor.god",
|
161
160
|
"mkdir -p /var/log/poolparty/",
|
162
161
|
"echo '-- Starting monitor_rack --'",
|
162
|
+
# NOTE: if someone has an old version of thin/rack on their system, this will fail silently and never finish bootstrapping
|
163
163
|
"thin -R /etc/poolparty/monitor.ru -p 8642 --pid /var/run/stats_monitor.pid --daemon -l /var/log/poolparty/monitor.log start 2>/dev/null",
|
164
164
|
"tail -n 20 /var/log/poolparty/monitor.log",
|
165
165
|
'echo "bootstrap" >> /var/poolparty/POOLPARTY.PROGRESS']
|
@@ -29,6 +29,13 @@ Ensure a command is run on the instances
|
|
29
29
|
default_options({
|
30
30
|
:path => ["/usr/bin:/bin:/usr/local/bin:$PATH"]
|
31
31
|
})
|
32
|
+
|
33
|
+
def loaded(o={})
|
34
|
+
if user
|
35
|
+
name "sudo -u #{user} -H #{name}"
|
36
|
+
dsl_options.delete(:user)
|
37
|
+
end
|
38
|
+
end
|
32
39
|
|
33
40
|
def present
|
34
41
|
nil
|
@@ -5,13 +5,18 @@ module PoolParty
|
|
5
5
|
|
6
6
|
dsl_methods :name, # Name of the user
|
7
7
|
:password, # Password for the user
|
8
|
-
:home,
|
8
|
+
:home, # Home directory
|
9
|
+
:gid, # primary group for user
|
9
10
|
:authorized_keys
|
10
11
|
|
11
12
|
|
12
13
|
default_options({
|
13
14
|
:shell => "/bin/sh"
|
14
15
|
})
|
16
|
+
|
17
|
+
def loaded(o={})
|
18
|
+
@group = dsl_options.delete(:group)
|
19
|
+
end
|
15
20
|
|
16
21
|
def after_create
|
17
22
|
if authorized_keys
|
@@ -4,6 +4,7 @@ require 'rack'
|
|
4
4
|
require 'json'
|
5
5
|
require 'thin'
|
6
6
|
require 'rest_client'
|
7
|
+
$:.unshift("#{::File.dirname(__FILE__)}/../../")
|
7
8
|
require "poolparty/monitors/monitor_rack"
|
8
9
|
|
9
10
|
app = Rack::Builder.new do
|
@@ -12,6 +13,17 @@ app = Rack::Builder.new do
|
|
12
13
|
use Rack::CommonLogger
|
13
14
|
# use Rack::PostBodyContentTypeParser #parses json requests to params hash
|
14
15
|
run Monitors::MonitorRack.new()
|
16
|
+
|
17
|
+
# Dumb daemon for now
|
18
|
+
begin
|
19
|
+
PoolParty::MonitorDaemon.run :daemonize => true,
|
20
|
+
:sleep_time => 10,
|
21
|
+
:log_file_path => "/var/log/poolparty/monitor_daemon.log"
|
22
|
+
|
23
|
+
rescue Exception => e
|
24
|
+
puts "Error with daemon: #{e.inspect}"
|
25
|
+
end
|
26
|
+
|
15
27
|
end
|
16
28
|
|
17
29
|
run app
|
@@ -17,9 +17,12 @@ describe "ec2 remote base" do
|
|
17
17
|
EOE
|
18
18
|
end
|
19
19
|
describe "helpers" do
|
20
|
-
it "should be able to convert an ec2 ip to a real ip" do
|
20
|
+
it "should be able to convert an american ec2 ip to a real ip" do
|
21
21
|
"ec2-72-44-36-12.compute-1.amazonaws.com".convert_from_ec2_to_ip.should == "72.44.36.12"
|
22
22
|
end
|
23
|
+
it "should be able to convert an european ec2 ip to a real ip" do
|
24
|
+
"ec2-72-44-36-12.eu-west-1.compute.amazonaws.com".convert_from_ec2_to_ip.should == "72.44.36.12"
|
25
|
+
end
|
23
26
|
it "should not throw an error if another string is returned" do
|
24
27
|
"72.44.36.12".convert_from_ec2_to_ip.should == "72.44.36.12"
|
25
28
|
end
|
@@ -49,7 +52,7 @@ describe "ec2 remote base" do
|
|
49
52
|
# @tr.launch_new_instance!
|
50
53
|
# end
|
51
54
|
it "should get the hash response from EC2ResponseObject" do
|
52
|
-
EC2ResponseObject.should_receive(:
|
55
|
+
EC2ResponseObject.should_receive(:describe_instance).and_return @ret_hash
|
53
56
|
@tr.launch_new_instance! :keypair => "keys"
|
54
57
|
end
|
55
58
|
end
|
@@ -87,8 +90,8 @@ describe "ec2 remote base" do
|
|
87
90
|
@resp = {"requestId"=>"be9bd2e9-4f8c-448f-993d-c21fe537e322", "addressesSet"=>{"item"=>[{"instanceId"=>nil, "publicIp"=>"174.129.212.93"}, {"instanceId"=>nil, "publicIp"=>"182.199.200.201"}]}, "xmlns"=>"http://ec2.amazonaws.com/doc/2008-12-01/"}
|
88
91
|
@tr.ec2.stub!(:describe_addresses).and_return @resp
|
89
92
|
end
|
90
|
-
it "should have the next available elastic_ip" do
|
91
|
-
@tr.next_unused_elastic_ip.should ==
|
93
|
+
it "should have the next available elastic_ip as nil if there are no ips set" do
|
94
|
+
@tr.next_unused_elastic_ip.should == nil
|
92
95
|
end
|
93
96
|
it "should use only the elastic ips set on the cloud" do
|
94
97
|
@tr.stub!(:elastic_ips).and_return ["182.199.200.201"]
|
@@ -4,14 +4,14 @@ require "open-uri"
|
|
4
4
|
# pool :application do
|
5
5
|
# instances 1..5
|
6
6
|
#
|
7
|
-
# cloud :
|
7
|
+
# cloud :frontend do
|
8
8
|
# minimum_instances 3
|
9
9
|
# keypair 'front'
|
10
10
|
# image_id "ami-abc123"
|
11
11
|
# has_file :name => "/etc/motd", :content => "Welcome to your PoolParty instance"
|
12
12
|
# end
|
13
13
|
#
|
14
|
-
# cloud :
|
14
|
+
# cloud :database do
|
15
15
|
# using :vmrun do
|
16
16
|
# vmx_hash "/path/to/vmx_file" => "192.168.248.122"
|
17
17
|
# end
|
@@ -27,55 +27,55 @@ describe "basic" do
|
|
27
27
|
@example_spec_file = ::File.join(::File.dirname(__FILE__), "..", "..", "..", "examples", 'basic.rb')
|
28
28
|
set_pool_specfile @example_spec_file
|
29
29
|
PoolParty::Pool::Pool.load_from_file(@example_spec_file)
|
30
|
-
@db = clouds[:
|
31
|
-
@app = clouds[:
|
30
|
+
@db = clouds[:database]
|
31
|
+
@app = clouds[:frontend]
|
32
32
|
end
|
33
33
|
it "should have a remote base" do
|
34
|
-
clouds[:
|
35
|
-
clouds[:
|
34
|
+
clouds[:frontend].remoter_base.should == :ec2
|
35
|
+
clouds[:frontend].remote_base.class.should == Ec2
|
36
36
|
end
|
37
37
|
it "should have one pool called :app" do
|
38
38
|
pool(:application).should_not == nil
|
39
39
|
pools[:application].should_not == nil
|
40
40
|
end
|
41
41
|
it "should have a cloud called :app" do
|
42
|
-
clouds[:
|
42
|
+
clouds[:frontend].should_not == nil
|
43
43
|
end
|
44
44
|
it "should have a cloud called :db" do
|
45
|
-
pools[:application].clouds[:
|
45
|
+
pools[:application].clouds[:database].should_not == nil
|
46
46
|
end
|
47
47
|
it "should set the minimum_instances on the cloud (overriding the pool options)" do
|
48
48
|
pools[:application].minimum_instances.should == 1
|
49
|
-
clouds[:
|
49
|
+
clouds[:frontend].minimum_instances.should == 3
|
50
50
|
end
|
51
51
|
it "should set the maximum_instances on the cloud to 5" do
|
52
|
-
clouds[:
|
52
|
+
clouds[:frontend].maximum_instances.should == 5
|
53
53
|
end
|
54
54
|
it "should set the minimum_instances on the db cloud " do
|
55
|
-
clouds[:
|
56
|
-
clouds[:
|
55
|
+
clouds[:database].minimum_instances.should == 1
|
56
|
+
clouds[:frontend].minimum_instances.should == 3
|
57
57
|
pools[:application].minimum_instances.should == 1
|
58
58
|
end
|
59
59
|
it "should set the parent to the pool" do
|
60
|
-
clouds[:
|
61
|
-
clouds[:
|
62
|
-
clouds[:
|
60
|
+
clouds[:frontend].parent.should == pools[:application]
|
61
|
+
clouds[:database].parent.should == pools[:application]
|
62
|
+
clouds[:database].parent.should_not == pools[:app]
|
63
63
|
end
|
64
64
|
it "should have the keypair matching /auser/on the db cloud " do
|
65
|
-
clouds[:
|
65
|
+
clouds[:database]._keypairs.select{|a| a.filepath.match(/auser/)}
|
66
66
|
end
|
67
67
|
it "cloud should know what remoter base it is using" do
|
68
|
-
clouds[:
|
68
|
+
clouds[:database].remote_base.class.should == PoolParty::Remote::Vmrun
|
69
69
|
end
|
70
70
|
it "cloud should have methods from the remoter base available" do
|
71
|
-
clouds[:
|
72
|
-
clouds[:
|
71
|
+
clouds[:database].remote_base.should_receive(:describe_instances).and_return({})
|
72
|
+
clouds[:database].describe_instances.should == {}
|
73
73
|
end
|
74
74
|
it "should not return nil to undefined methods" do
|
75
|
-
lambda {clouds[:
|
75
|
+
lambda {clouds[:database].not_a_method_that_exists_anywhere}.should raise_error
|
76
76
|
end
|
77
77
|
it "should have the keypair set for the specific cloud on top of the keypair stack" do
|
78
78
|
#I think this should be the behavior. mf
|
79
|
-
# pools[:application].clouds[:
|
79
|
+
# pools[:application].clouds[:database].keypairs.last.filepath.should_match(/auser/)
|
80
80
|
end
|
81
81
|
end
|
@@ -1,40 +1,39 @@
|
|
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
|
-
end
|
1
|
+
# TODO: UPDATE THIS
|
2
|
+
# require File.dirname(__FILE__) + '/../spec_helper'
|
3
|
+
#
|
4
|
+
# describe "Sshkey" do
|
5
|
+
# describe "instances" do
|
6
|
+
# before(:each) do
|
7
|
+
# @key = Key.new
|
8
|
+
# Key.stub!(:new).and_return @key
|
9
|
+
# @key.stub!(:content).and_return "DIGITSOFTHEKEY"
|
10
|
+
# @tc = TestBaseClass.new do
|
11
|
+
# has_sshkey({:name => "~/.ssh/id_rsa"})
|
12
|
+
# end
|
13
|
+
# @dir = @tc.resource(:sshkey).first
|
14
|
+
# end
|
15
|
+
# it "have the name in the options" do
|
16
|
+
# @dir.name.should == "~/.ssh/id_rsa"
|
17
|
+
# end
|
18
|
+
# it "should store the owner's name" do
|
19
|
+
# @dir.enctype.should == "rsa"
|
20
|
+
# end
|
21
|
+
# describe "into PuppetResolver" do
|
22
|
+
# before(:each) do
|
23
|
+
# @compiled = PuppetResolver.new(@tc.to_properties_hash).compile
|
24
|
+
# end
|
25
|
+
# it "should set the filename to the name of the file" do
|
26
|
+
# @compiled.should match(/sshkey \{ "~\/\.ssh\/id_rsa"/)
|
27
|
+
# end
|
28
|
+
# it "should say it's a sshkey in the ensure method" do
|
29
|
+
# @compiled.should match(/ensure => "present"/)
|
30
|
+
# end
|
31
|
+
# it "have the mode set in the puppet output" do
|
32
|
+
# @compiled.should match(/type => "rsa"/)
|
33
|
+
# end
|
34
|
+
# it "have the long string of digits key" do
|
35
|
+
# @compiled.should match(/key => "DIGITSOFTHEKEY"/)
|
36
|
+
# end
|
37
|
+
# end
|
38
|
+
# end
|
39
|
+
# end
|