auser-poolparty 0.2.79 → 0.2.80
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +38 -33
- data/PostInstall.txt +1 -1
- data/bin/cloud-provision +1 -1
- data/bin/cloud-spec +40 -0
- data/lib/poolparty.rb +2 -2
- data/lib/poolparty/base_packages/poolparty.rb +1 -1
- data/lib/poolparty/extra/deployments.rb +31 -0
- data/lib/poolparty/helpers/binary.rb +9 -0
- data/lib/poolparty/modules/cloud_dsl.rb +1 -1
- data/lib/poolparty/modules/cloud_resourcer.rb +2 -0
- data/lib/poolparty/modules/file_writer.rb +2 -2
- data/lib/poolparty/net/messenger.rb +1 -1
- data/lib/poolparty/net/remote_bases/ec2.rb +5 -2
- data/lib/poolparty/net/remoter.rb +2 -4
- data/lib/poolparty/net/remoter_base.rb +7 -0
- data/lib/poolparty/poolparty/cloud.rb +22 -7
- data/lib/poolparty/poolparty/plugin_model.rb +4 -4
- data/lib/poolparty/poolparty/pool.rb +1 -0
- data/lib/poolparty/poolparty/resource.rb +1 -1
- data/lib/poolparty/poolparty/resources/directory.rb +2 -2
- data/lib/poolparty/poolparty/resources/file.rb +2 -2
- data/lib/poolparty/poolparty/resources/remote_file.rb +1 -1
- data/lib/poolparty/poolparty/resources/remote_user.rb +17 -0
- data/lib/poolparty/{helpers → provisioners}/provisioner_base.rb +10 -4
- data/lib/poolparty/{helpers → provisioners}/provisioners/master.rb +11 -7
- data/lib/poolparty/{helpers → provisioners}/provisioners/slave.rb +0 -0
- data/lib/poolparty/templates/puppetrerun +2 -1
- data/lib/poolparty/version.rb +1 -1
- data/poolparty.gemspec +42 -36
- data/spec/poolparty/extra/deployments_spec.rb +64 -0
- data/spec/poolparty/helpers/provisioner_base_spec.rb +0 -1
- data/spec/poolparty/helpers/provisioners/master_spec.rb +0 -1
- data/spec/poolparty/helpers/provisioners/slave_spec.rb +0 -1
- data/spec/poolparty/{pool → poolparty}/base_spec.rb +0 -0
- data/spec/poolparty/{pool → poolparty}/cloud_spec.rb +37 -0
- data/spec/poolparty/{pool → poolparty}/configurers/files/ruby_basic.rb +0 -0
- data/spec/poolparty/{pool → poolparty}/configurers/files/ruby_plugins.rb +0 -0
- data/spec/poolparty/{pool → poolparty}/configurers/ruby_spec.rb +0 -0
- data/spec/poolparty/{pool → poolparty}/custom_resource_spec.rb +0 -0
- data/spec/poolparty/{pool → poolparty}/example_spec.rb +0 -0
- data/spec/poolparty/{pool → poolparty}/plugin_model_spec.rb +0 -0
- data/spec/poolparty/{pool → poolparty}/plugin_spec.rb +0 -0
- data/spec/poolparty/{pool → poolparty}/pool_spec.rb +0 -0
- data/spec/poolparty/{pool → poolparty}/resource_spec.rb +0 -0
- data/spec/poolparty/{pool → poolparty}/resources/class_package_spec.rb +0 -0
- data/spec/poolparty/{pool → poolparty}/resources/conditional_spec.rb +0 -0
- data/spec/poolparty/{pool → poolparty}/resources/cron_spec.rb +0 -0
- data/spec/poolparty/{pool → poolparty}/resources/directory_spec.rb +0 -0
- data/spec/poolparty/{pool → poolparty}/resources/exec_spec.rb +0 -0
- data/spec/poolparty/{pool → poolparty}/resources/file_spec.rb +0 -0
- data/spec/poolparty/{pool → poolparty}/resources/gem_spec.rb +0 -0
- data/spec/poolparty/{pool → poolparty}/resources/host_spec.rb +0 -0
- data/spec/poolparty/{pool → poolparty}/resources/package_spec.rb +0 -0
- data/spec/poolparty/{pool → poolparty}/resources/remote_file_spec.rb +0 -0
- data/spec/poolparty/{pool → poolparty}/resources/service_spec.rb +0 -0
- data/spec/poolparty/{pool → poolparty}/resources/sshkey_spec.rb +0 -0
- data/spec/poolparty/{pool → poolparty}/resources/symlink_spec.rb +0 -0
- data/spec/poolparty/poolparty/resources/user_spec.rb +38 -0
- data/spec/poolparty/{pool → poolparty}/resources/variable_spec.rb +0 -0
- data/spec/poolparty/{pool → poolparty}/script_spec.rb +0 -0
- data/spec/poolparty/{pool → poolparty}/test_plugins/sshkey_test +0 -0
- data/spec/poolparty/{pool → poolparty}/test_plugins/virtual_host_template.erb +0 -0
- data/spec/poolparty/{pool → poolparty}/test_plugins/webserver.rb +0 -0
- data/website/index.html +107 -0
- metadata +42 -36
- data/lib/erlang/messenger/src/pm_client_old.erl +0 -52
@@ -47,6 +47,7 @@ module PoolParty
|
|
47
47
|
|
48
48
|
def setup_defaults
|
49
49
|
plugin_directory "#{::File.dirname(pool_specfile ? pool_specfile : Dir.pwd)}/plugins"
|
50
|
+
PoolParty::Extra::Deployments.include_deployments "#{Dir.pwd}/deployments"
|
50
51
|
end
|
51
52
|
|
52
53
|
# This is where the entire process starts
|
@@ -225,7 +225,7 @@ module PoolParty
|
|
225
225
|
:subscribe, :owner, :group, :path, :mode, :source, :notify, :subscribe, :check, :creates, :cwd, :command, :ensure,
|
226
226
|
:require, :schedule, :range, :alias, :hour, :minute, :user, :month, :monthday, :name, :onlyif, :unless, :refreshonly,
|
227
227
|
:refresh, :content, :template, :ip, :repeat, :provider, :key, :device, :fstype, :remounts, :options, :atboot, :before,
|
228
|
-
:binary, :status, :start, :stop, :restart, :pattern, :recurse
|
228
|
+
:binary, :status, :start, :stop, :restart, :pattern, :recurse, :home
|
229
229
|
]
|
230
230
|
end
|
231
231
|
def key
|
@@ -98,7 +98,7 @@ module PoolParty
|
|
98
98
|
|
99
99
|
before_install(@instance)
|
100
100
|
|
101
|
-
process_clean_reconfigure_for!(@instance, testing)
|
101
|
+
# process_clean_reconfigure_for!(@instance, testing)
|
102
102
|
|
103
103
|
vputs "Logging in and running provisioning on #{@instance.name}"
|
104
104
|
# /bin/rm install_#{name}.sh
|
@@ -162,7 +162,7 @@ module PoolParty
|
|
162
162
|
s << "puppetca --clean master.compute-1.internal 2>&1 > /dev/null;"
|
163
163
|
s << "puppetca --clean master.ec2.internal 2>&1 > /dev/null"
|
164
164
|
end
|
165
|
-
@cloud.run_command_on("if [ -f '/usr/bin/puppetcleaner' ]; then /usr/bin/env puppetcleaner
|
165
|
+
@cloud.run_command_on("if [ -f '/usr/bin/puppetcleaner' ]; then /usr/bin/env puppetcleaner `hostname`; else #{str}; fi", @cloud.master)
|
166
166
|
end
|
167
167
|
def process_reconfigure!(testing=false)
|
168
168
|
@cloud.run_command_on(PoolParty::Remote::RemoteInstance.puppet_runner_command, @instance) unless testing
|
@@ -211,6 +211,7 @@ module PoolParty
|
|
211
211
|
def default_install_tasks
|
212
212
|
[
|
213
213
|
"#!/usr/bin/env sh",
|
214
|
+
first_install_tasks,
|
214
215
|
upgrade_system,
|
215
216
|
install_rubygems,
|
216
217
|
make_logger_directory,
|
@@ -231,6 +232,11 @@ module PoolParty
|
|
231
232
|
def install_tasks(a=[])
|
232
233
|
@install_task ||= a
|
233
234
|
end
|
235
|
+
# Set the first tasks to be called on the instance
|
236
|
+
# before any other tasks are run
|
237
|
+
def first_install_tasks
|
238
|
+
@cloud.first_install_tasks_for(@instances) || []
|
239
|
+
end
|
234
240
|
def configure_tasks(a=[])
|
235
241
|
@configure_tasks ||= a
|
236
242
|
end
|
@@ -357,8 +363,8 @@ fi
|
|
357
363
|
cp #{Base.remote_storage_path}/#{Base.template_directory}/puppetrerun /usr/bin/puppetrerun
|
358
364
|
chmod +x /usr/bin/puppetrerun
|
359
365
|
|
360
|
-
|
361
|
-
chmod
|
366
|
+
mv #{Base.remote_storage_path}/cookie ~/.erlang.cookie
|
367
|
+
chmod 400 ~/.erlang.cookie
|
362
368
|
EOS
|
363
369
|
end
|
364
370
|
end
|
@@ -15,10 +15,15 @@ module PoolParty
|
|
15
15
|
def error
|
16
16
|
raise RemoteException.new(:could_not_install, "Your cloud does not have a master")
|
17
17
|
end
|
18
|
+
|
19
|
+
def first_install_tasks
|
20
|
+
[
|
21
|
+
create_local_hosts_entry
|
22
|
+
]
|
23
|
+
end
|
18
24
|
|
19
25
|
def install_tasks
|
20
|
-
[
|
21
|
-
create_local_hosts_entry,
|
26
|
+
[
|
22
27
|
setup_basic_structure,
|
23
28
|
setup_configs,
|
24
29
|
setup_fileserver,
|
@@ -128,14 +133,13 @@ wget http://github.com/auser/poolparty/tree/master%2Fpkg%2Fpoolparty.gem?raw=tru
|
|
128
133
|
EOE
|
129
134
|
end
|
130
135
|
|
131
|
-
# ps aux | grep puppetmasterd | awk '{print $2}' | xargs kill
|
132
136
|
# /etc/init.d/puppetmaster stop; rm -rf /etc/puppet/ssl; /etc/init.d/puppetmaster start
|
137
|
+
# ps aux | grep puppetmaster | grep -v grep | awk '{print $2}' | xargs kill;
|
133
138
|
def restart_puppetmaster
|
134
139
|
<<-EOS
|
135
140
|
echo "(Re)starting poolparty"
|
136
141
|
. /etc/profile
|
137
|
-
|
138
|
-
ps aux | grep puppetmaster | awk '{print $2}' | xargs kill;rm -rf /etc/poolparty/ssl;puppetmasterd --verbose;/etc/init.d/puppetmaster start
|
142
|
+
/etc/init.d/puppetmaster stop;rm -rf /etc/poolparty/ssl;puppetmasterd --verbose;/etc/init.d/puppetmaster start
|
139
143
|
EOS
|
140
144
|
end
|
141
145
|
|
@@ -181,10 +185,10 @@ cp #{Base.remote_storage_path}/poolparty.pp /etc/puppet/manifests/classes/poolpa
|
|
181
185
|
|
182
186
|
def restart_puppetd
|
183
187
|
# /usr/bin/puppetrerun
|
188
|
+
# /usr/bin/puppetcleaner master
|
184
189
|
<<-EOS
|
185
190
|
echo "Running puppet manifest"
|
186
|
-
/usr/
|
187
|
-
/usr/bin/puppetcleaner master
|
191
|
+
/usr/bin/puppetrerun
|
188
192
|
EOS
|
189
193
|
end
|
190
194
|
end
|
File without changes
|
@@ -11,7 +11,8 @@ if [ $(/usr/sbin/puppetd --onetime --no-daemonize --logdest syslog --server mast
|
|
11
11
|
if [ $(/usr/sbin/puppetd --onetime --no-daemonize --logdest syslog --server master) ]; then
|
12
12
|
echo "Run successfully" && exit 0
|
13
13
|
else
|
14
|
-
/etc/init.d/puppetmaster stop;rm -rf /etc/poolparty/ssl;/etc/init.d/puppetmaster start
|
14
|
+
# /etc/init.d/puppetmaster stop;rm -rf /etc/poolparty/ssl;/etc/init.d/puppetmaster start
|
15
|
+
rm /etc/poolparty/ssl/$HN*
|
15
16
|
/usr/sbin/puppetd --onetime --no-daemonize --logdest syslog --server master
|
16
17
|
fi
|
17
18
|
else
|
data/lib/poolparty/version.rb
CHANGED
data/poolparty.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: poolparty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.80
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ari Lerner
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-12-
|
12
|
+
date: 2008-12-09 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -70,6 +70,7 @@ executables:
|
|
70
70
|
- cloud-refresh
|
71
71
|
- cloud-rsync
|
72
72
|
- cloud-run
|
73
|
+
- cloud-spec
|
73
74
|
- cloud-ssh
|
74
75
|
- cloud-start
|
75
76
|
- cloud-stats
|
@@ -130,6 +131,7 @@ files:
|
|
130
131
|
- bin/cloud-refresh
|
131
132
|
- bin/cloud-rsync
|
132
133
|
- bin/cloud-run
|
134
|
+
- bin/cloud-spec
|
133
135
|
- bin/cloud-ssh
|
134
136
|
- bin/cloud-start
|
135
137
|
- bin/cloud-stats
|
@@ -264,7 +266,6 @@ files:
|
|
264
266
|
- lib/erlang/messenger/src/master_app.erl
|
265
267
|
- lib/erlang/messenger/src/node_app.erl
|
266
268
|
- lib/erlang/messenger/src/pm_client.erl
|
267
|
-
- lib/erlang/messenger/src/pm_client_old.erl
|
268
269
|
- lib/erlang/messenger/src/pm_client_supervisor.erl
|
269
270
|
- lib/erlang/messenger/src/pm_cluster.erl
|
270
271
|
- lib/erlang/messenger/src/pm_event_manager.erl
|
@@ -311,14 +312,12 @@ files:
|
|
311
312
|
- lib/poolparty/exceptions/SpecException.rb
|
312
313
|
- lib/poolparty/exceptions/TemplateNotFound.rb
|
313
314
|
- lib/poolparty/exceptions/UnacceptableCommand.rb
|
315
|
+
- lib/poolparty/extra/deployments.rb
|
314
316
|
- lib/poolparty/helpers/binary.rb
|
315
317
|
- lib/poolparty/helpers/console.rb
|
316
318
|
- lib/poolparty/helpers/display.rb
|
317
319
|
- lib/poolparty/helpers/nice_printer.rb
|
318
320
|
- lib/poolparty/helpers/optioner.rb
|
319
|
-
- lib/poolparty/helpers/provisioner_base.rb
|
320
|
-
- lib/poolparty/helpers/provisioners/master.rb
|
321
|
-
- lib/poolparty/helpers/provisioners/slave.rb
|
322
321
|
- lib/poolparty/helpers/ruberl.rb
|
323
322
|
- lib/poolparty/modules/cloud_dsl.rb
|
324
323
|
- lib/poolparty/modules/cloud_resourcer.rb
|
@@ -369,11 +368,15 @@ files:
|
|
369
368
|
- lib/poolparty/poolparty/resources/mount.rb
|
370
369
|
- lib/poolparty/poolparty/resources/package.rb
|
371
370
|
- lib/poolparty/poolparty/resources/remote_file.rb
|
371
|
+
- lib/poolparty/poolparty/resources/remote_user.rb
|
372
372
|
- lib/poolparty/poolparty/resources/service.rb
|
373
373
|
- lib/poolparty/poolparty/resources/sshkey.rb
|
374
374
|
- lib/poolparty/poolparty/resources/symlink.rb
|
375
375
|
- lib/poolparty/poolparty/resources/variable.rb
|
376
376
|
- lib/poolparty/poolparty/script.rb
|
377
|
+
- lib/poolparty/provisioners/provisioner_base.rb
|
378
|
+
- lib/poolparty/provisioners/provisioners/master.rb
|
379
|
+
- lib/poolparty/provisioners/provisioners/slave.rb
|
377
380
|
- lib/poolparty/spec/core/string.rb
|
378
381
|
- lib/poolparty/spec/matchers/a_spec_extensions_base.rb
|
379
382
|
- lib/poolparty/spec/matchers/have_cron.rb
|
@@ -437,6 +440,7 @@ files:
|
|
437
440
|
- spec/poolparty/core/string_spec.rb
|
438
441
|
- spec/poolparty/core/time_spec.rb
|
439
442
|
- spec/poolparty/dependency_resolutions/base_spec.rb
|
443
|
+
- spec/poolparty/extra/deployments_spec.rb
|
440
444
|
- spec/poolparty/helpers/binary_spec.rb
|
441
445
|
- spec/poolparty/helpers/display_spec.rb
|
442
446
|
- spec/poolparty/helpers/optioner_spec.rb
|
@@ -461,35 +465,36 @@ files:
|
|
461
465
|
- spec/poolparty/plugins/git_spec.rb
|
462
466
|
- spec/poolparty/plugins/line_spec.rb
|
463
467
|
- spec/poolparty/plugins/svn_spec.rb
|
464
|
-
- spec/poolparty/
|
465
|
-
- spec/poolparty/
|
466
|
-
- spec/poolparty/
|
467
|
-
- spec/poolparty/
|
468
|
-
- spec/poolparty/
|
469
|
-
- spec/poolparty/
|
470
|
-
- spec/poolparty/
|
471
|
-
- spec/poolparty/
|
472
|
-
- spec/poolparty/
|
473
|
-
- spec/poolparty/
|
474
|
-
- spec/poolparty/
|
475
|
-
- spec/poolparty/
|
476
|
-
- spec/poolparty/
|
477
|
-
- spec/poolparty/
|
478
|
-
- spec/poolparty/
|
479
|
-
- spec/poolparty/
|
480
|
-
- spec/poolparty/
|
481
|
-
- spec/poolparty/
|
482
|
-
- spec/poolparty/
|
483
|
-
- spec/poolparty/
|
484
|
-
- spec/poolparty/
|
485
|
-
- spec/poolparty/
|
486
|
-
- spec/poolparty/
|
487
|
-
- spec/poolparty/
|
488
|
-
- spec/poolparty/
|
489
|
-
- spec/poolparty/
|
490
|
-
- spec/poolparty/
|
491
|
-
- spec/poolparty/
|
492
|
-
- spec/poolparty/
|
468
|
+
- spec/poolparty/poolparty/base_spec.rb
|
469
|
+
- spec/poolparty/poolparty/cloud_spec.rb
|
470
|
+
- spec/poolparty/poolparty/configurers/files/ruby_basic.rb
|
471
|
+
- spec/poolparty/poolparty/configurers/files/ruby_plugins.rb
|
472
|
+
- spec/poolparty/poolparty/configurers/ruby_spec.rb
|
473
|
+
- spec/poolparty/poolparty/custom_resource_spec.rb
|
474
|
+
- spec/poolparty/poolparty/example_spec.rb
|
475
|
+
- spec/poolparty/poolparty/plugin_model_spec.rb
|
476
|
+
- spec/poolparty/poolparty/plugin_spec.rb
|
477
|
+
- spec/poolparty/poolparty/pool_spec.rb
|
478
|
+
- spec/poolparty/poolparty/resource_spec.rb
|
479
|
+
- spec/poolparty/poolparty/resources/class_package_spec.rb
|
480
|
+
- spec/poolparty/poolparty/resources/conditional_spec.rb
|
481
|
+
- spec/poolparty/poolparty/resources/cron_spec.rb
|
482
|
+
- spec/poolparty/poolparty/resources/directory_spec.rb
|
483
|
+
- spec/poolparty/poolparty/resources/exec_spec.rb
|
484
|
+
- spec/poolparty/poolparty/resources/file_spec.rb
|
485
|
+
- spec/poolparty/poolparty/resources/gem_spec.rb
|
486
|
+
- spec/poolparty/poolparty/resources/host_spec.rb
|
487
|
+
- spec/poolparty/poolparty/resources/package_spec.rb
|
488
|
+
- spec/poolparty/poolparty/resources/remote_file_spec.rb
|
489
|
+
- spec/poolparty/poolparty/resources/service_spec.rb
|
490
|
+
- spec/poolparty/poolparty/resources/sshkey_spec.rb
|
491
|
+
- spec/poolparty/poolparty/resources/symlink_spec.rb
|
492
|
+
- spec/poolparty/poolparty/resources/user_spec.rb
|
493
|
+
- spec/poolparty/poolparty/resources/variable_spec.rb
|
494
|
+
- spec/poolparty/poolparty/script_spec.rb
|
495
|
+
- spec/poolparty/poolparty/test_plugins/sshkey_test
|
496
|
+
- spec/poolparty/poolparty/test_plugins/virtual_host_template.erb
|
497
|
+
- spec/poolparty/poolparty/test_plugins/webserver.rb
|
493
498
|
- spec/poolparty/poolparty_spec.rb
|
494
499
|
- spec/poolparty/spec/core/string_spec.rb
|
495
500
|
- spec/poolparty/spec_helper.rb
|
@@ -506,6 +511,7 @@ files:
|
|
506
511
|
- test/test_helper.rb
|
507
512
|
- test/test_pool_spec_generator.rb
|
508
513
|
- test/test_poolparty.rb
|
514
|
+
- website/index.html
|
509
515
|
- website/index.txt
|
510
516
|
- website/javascripts/rounded_corners_lite.inc.js
|
511
517
|
- website/stylesheets/code.css
|
@@ -514,7 +520,7 @@ files:
|
|
514
520
|
has_rdoc: true
|
515
521
|
homepage: http://poolparty.rubyforge.org
|
516
522
|
post_install_message: |-
|
517
|
-
Get ready to jump in the pool, you just installed PoolParty! (Updated at
|
523
|
+
Get ready to jump in the pool, you just installed PoolParty! (Updated at 15:39 12/09/08)
|
518
524
|
|
519
525
|
To get started, run the generator:
|
520
526
|
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe "deployments" do
|
4
|
+
describe "class" do
|
5
|
+
before(:each) do
|
6
|
+
@klass = PoolParty::Extra::Deployments
|
7
|
+
@file = "hanky_danky_ranky.pool"
|
8
|
+
::File.stub!(:file?).with(@file).and_return false
|
9
|
+
end
|
10
|
+
it "should have the singleton method include_deployment" do
|
11
|
+
@klass.respond_to?(:include_deployment).should == true
|
12
|
+
end
|
13
|
+
it "should return nil if the file doesn't exist" do
|
14
|
+
@klass.include_deployment(@file).should == nil
|
15
|
+
end
|
16
|
+
describe "existing file" do
|
17
|
+
before(:each) do
|
18
|
+
::File.stub!(:file?).and_return true
|
19
|
+
@contents = "'hello goober'"
|
20
|
+
@klass.stub!(:open).with(@file).and_return @file
|
21
|
+
@file.stub!(:read).and_return @contents
|
22
|
+
end
|
23
|
+
it "should not be nil if the file does exist" do
|
24
|
+
@klass.include_deployment(@file).should_not == nil
|
25
|
+
end
|
26
|
+
it "should create a class called PoolPartyHankyDankyRankyClass" do
|
27
|
+
@klass.include_deployment(@file).should_not == nil
|
28
|
+
Object.const_defined?(:PoolPartyHankyDankyRankyClass).should == true
|
29
|
+
end
|
30
|
+
it "should create a method on the class called enable" do
|
31
|
+
PoolPartyHankyDankyRankyClass.new.respond_to?(:enable).should == true
|
32
|
+
end
|
33
|
+
it "should add the contents of the file to be eval'd on the method" do
|
34
|
+
PoolPartyHankyDankyRankyClass.new.enable.should == "hello goober"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
describe "include_deployments" do
|
38
|
+
before(:each) do
|
39
|
+
::File.stub!(:directory?).and_return false
|
40
|
+
@dir = "/deployments"
|
41
|
+
end
|
42
|
+
it "should have the method include_deployments" do
|
43
|
+
@klass.respond_to?(:include_deployments).should == true
|
44
|
+
end
|
45
|
+
it "should return nil if the directory does not exist" do
|
46
|
+
@klass.include_deployments(@dir).should == nil
|
47
|
+
end
|
48
|
+
describe "existing directory" do
|
49
|
+
before(:each) do
|
50
|
+
::File.stub!(:directory?).and_return true
|
51
|
+
@contents = []
|
52
|
+
Dir.stub!(:[]).and_return @contents
|
53
|
+
end
|
54
|
+
it "should not be nil if the directory exists" do
|
55
|
+
@klass.include_deployments(@dir).should_not == nil
|
56
|
+
end
|
57
|
+
it "should call Dir.[] on the directory" do
|
58
|
+
Dir.should_receive(:[]).with("#{@dir}/*").and_return []
|
59
|
+
@klass.include_deployments(@dir)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
File without changes
|
@@ -316,6 +316,9 @@ describe "Cloud" do
|
|
316
316
|
it "should call before_configuration_tasks callback" do
|
317
317
|
@cloud.should_receive(:before_configuration_tasks).once
|
318
318
|
end
|
319
|
+
it "should call call write_unique_cookie" do
|
320
|
+
@cloud.should_receive(:write_unique_cookie).once
|
321
|
+
end
|
319
322
|
describe "copy_custom_monitors" do
|
320
323
|
before(:each) do
|
321
324
|
Base.stub!(:custom_monitor_directories).and_return ["/tmp/monitors/custom_monitor.rb"]
|
@@ -364,6 +367,40 @@ describe "Cloud" do
|
|
364
367
|
end
|
365
368
|
end
|
366
369
|
end
|
370
|
+
describe "minimum_runnable_options" do
|
371
|
+
it "should be an array on the cloud" do
|
372
|
+
@cloud.minimum_runnable_options.class.should == Array
|
373
|
+
end
|
374
|
+
["keypair","minimum_instances","maximum_instances",
|
375
|
+
"expand_when","contract_when","set_master_ip_to"].each do |k|
|
376
|
+
eval <<-EOE
|
377
|
+
it "should have #{k} in the minimum_runnable_options" do
|
378
|
+
@cloud.minimum_runnable_options.include?(:#{k}).should == true
|
379
|
+
end
|
380
|
+
EOE
|
381
|
+
end
|
382
|
+
it "should include the custom_minimum_runnable_options" do
|
383
|
+
@cloud.stub!(:custom_minimum_runnable_options).and_return [:blank]
|
384
|
+
@cloud.minimum_runnable_options.include?(:blank).should == true
|
385
|
+
end
|
386
|
+
end
|
387
|
+
describe "unique_cookie" do
|
388
|
+
it "should have the method generate generate_unique_cookie_string" do
|
389
|
+
@cloud.respond_to?(:generate_unique_cookie_string).should == true
|
390
|
+
end
|
391
|
+
it "should call hexdigest to digest/sha" do
|
392
|
+
Digest::SHA256.should_receive(:hexdigest).with("#{@cloud.full_keypair_name}#{@cloud.name}")
|
393
|
+
@cloud.generate_unique_cookie_string
|
394
|
+
end
|
395
|
+
it "should generate the same cookie string every time" do
|
396
|
+
older = @cloud.generate_unique_cookie_string
|
397
|
+
old = @cloud.generate_unique_cookie_string
|
398
|
+
new_one = @cloud.generate_unique_cookie_string
|
399
|
+
older.should == old
|
400
|
+
old.should == new_one
|
401
|
+
new_one.should == older
|
402
|
+
end
|
403
|
+
end
|
367
404
|
end
|
368
405
|
|
369
406
|
describe "instances" do
|