auser-poolparty 0.2.81 → 0.2.84

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.
Files changed (49) hide show
  1. data/Capfile +1 -0
  2. data/Manifest.txt +13 -6
  3. data/PostInstall.txt +1 -1
  4. data/bin/cloud-configure +2 -1
  5. data/bin/cloud-handle-load +3 -3
  6. data/bin/cloud-maintain +2 -2
  7. data/bin/cloud-provision +4 -4
  8. data/bin/cloud-setup-dev +25 -0
  9. data/bin/cloud-start +1 -0
  10. data/bin/server-start-client +1 -1
  11. data/bin/server-start-master +1 -1
  12. data/bin/server-start-node +1 -1
  13. data/bin/server-write-new-nodes +26 -0
  14. data/lib/poolparty/capistrano.rb +18 -0
  15. data/lib/poolparty/exceptions/ProvisionerException.rb +5 -0
  16. data/lib/poolparty/helpers/optioner.rb +2 -1
  17. data/lib/poolparty/modules/cloud_resourcer.rb +17 -0
  18. data/lib/poolparty/modules/file_writer.rb +2 -2
  19. data/lib/poolparty/net/messenger.rb +1 -1
  20. data/lib/poolparty/net/remote_bases/ec2.rb +3 -2
  21. data/lib/poolparty/net/remoter.rb +12 -8
  22. data/lib/poolparty/plugins/git.rb +5 -1
  23. data/lib/poolparty/poolparty/cloud.rb +3 -1
  24. data/lib/poolparty/provisioners/capistrano/capistrano.rb +129 -0
  25. data/lib/poolparty/provisioners/capistrano/capistrano_configurer.rb +58 -0
  26. data/lib/poolparty/provisioners/capistrano/recipies/base.rb +100 -0
  27. data/lib/poolparty/provisioners/capistrano/recipies/master.rb +120 -0
  28. data/lib/poolparty/provisioners/capistrano/recipies/slave.rb +12 -0
  29. data/lib/poolparty/provisioners/provisioner_base.rb +98 -274
  30. data/lib/poolparty/templates/gem +12 -10
  31. data/lib/poolparty/version.rb +1 -1
  32. data/lib/poolparty.rb +5 -3
  33. data/poolparty.gemspec +18 -9
  34. data/spec/poolparty/helpers/optioner_spec.rb +1 -1
  35. data/spec/poolparty/net/remote_spec.rb +13 -14
  36. data/spec/poolparty/net/remoter_spec.rb +11 -11
  37. data/spec/poolparty/plugins/git_spec.rb +1 -1
  38. data/spec/poolparty/poolparty_spec.rb +1 -1
  39. data/spec/poolparty/provisioners/capistrano/capistrano_spec.rb +27 -0
  40. data/spec/poolparty/provisioners/provisioner_base_spec.rb +120 -0
  41. data/spec/poolparty/spec_helper.rb +15 -1
  42. data/website/index.html +1 -1
  43. metadata +18 -9
  44. data/lib/poolparty/provisioners/provisioners/become_master.rb +0 -166
  45. data/lib/poolparty/provisioners/provisioners/master.rb +0 -196
  46. data/lib/poolparty/provisioners/provisioners/slave.rb +0 -65
  47. data/spec/poolparty/helpers/provisioner_base_spec.rb +0 -137
  48. data/spec/poolparty/helpers/provisioners/master_spec.rb +0 -53
  49. data/spec/poolparty/helpers/provisioners/slave_spec.rb +0 -27
@@ -13,6 +13,8 @@ end
13
13
 
14
14
  describe "Remote" do
15
15
  before(:each) do
16
+ @cloud = cloud :test_cloud do;end
17
+
16
18
  @tc = TestClass.new
17
19
  @tc.stub!(:verbose).and_return false
18
20
  setup
@@ -207,13 +209,21 @@ describe "Remote" do
207
209
  before(:each) do
208
210
  setup
209
211
  stub_list_from_remote_for(@tc)
210
- @tc.stub!(:request_launch_new_instances).and_return PoolParty::Remote::RemoteInstance.new(:ip => "127.0.0.1", :num => 1)
212
+ @ri = PoolParty::Remote::RemoteInstance.new(:ip => "127.0.0.1", :num => 1, :name => "master")
213
+ @tc.stub!(:request_launch_new_instances).and_return @ri
211
214
  @tc.stub!(:can_start_a_new_instance).and_return true
212
215
  @tc.stub!(:list_of_pending_instances).and_return []
213
216
  @tc.stub!(:prepare_for_configuration).and_return true
214
217
  @tc.stub!(:build_and_store_new_config_file).and_return true
215
218
  PoolParty::Provisioner.stub!(:provision_slaves).and_return true
216
- Kernel.stub!(:system).and_return true
219
+ @cloud.stub!(:master).and_return @ri
220
+ @cloud.stub!(:list_of_nonterminated_instances).and_return [@ri]
221
+ @cloud.stub!(:full_keypair_path).and_return "keyairs"
222
+
223
+ @provisioner = PoolParty::Provisioner::Capistrano.new(@ri, @cloud, :ubuntu)
224
+ PoolParty::Provisioner::Capistrano.stub!(:new).and_return @provisioner
225
+ @provisioner.stub!(:install).and_return true
226
+ @provisioner.stub!(:configure).and_return true
217
227
  end
218
228
  it "should receive can_start_a_new_instance?" do
219
229
  @tc.should_receive(:can_start_a_new_instance?).once
@@ -227,12 +237,7 @@ describe "Remote" do
227
237
  end
228
238
  it "should call a new slave provisioner" do
229
239
  @tc.stub!(:should_expand_cloud?).once.and_return true
230
- PoolParty::Provisioner.should_receive(:provision_slave).at_least(1)
231
- # Kernel.should_receive(:system).with(". /etc/profile && cloud-provision -i 5 2>&1 > /dev/null &").and_return true
232
- end
233
- it "should call reconfigure on the master to pick up the new slave" do
234
- @tc.stub!(:should_expand_cloud?).once.and_return true
235
- PoolParty::Provisioner.should_receive(:reconfigure_master).once
240
+ @provisioner.should_receive(:install).at_least(1)
236
241
  end
237
242
  after(:each) do
238
243
  @tc.expand_cloud_if_necessary
@@ -269,12 +274,6 @@ describe "Remote" do
269
274
  @obj = Object.new
270
275
  @obj.stub!(:ip).and_return "192.168.0.1"
271
276
  end
272
- it "should raise an exception if it cannot find the keypair" do
273
- @tc.stub!(:keypair_path).and_return nil
274
- lambda {
275
- @tc.rsync_storage_files_to(@tc.master)
276
- }.should raise_error
277
- end
278
277
  it "should call exec on the kernel" do
279
278
  @tc.stub!(:keypair).and_return "funky"
280
279
  ::File.stub!(:exists?).with("#{File.expand_path(Base.base_keypair_path)}/id_rsa-funky").and_return true
@@ -11,7 +11,7 @@ describe "Remoter" do
11
11
  end
12
12
  describe "ssh_string" do
13
13
  it "should have the ssh command" do
14
- @tc.ssh_string.should =~ /ssh -o StrictHostKeyChecking=no -l '#{Base.user}' -i/
14
+ @tc.ssh_string.should =~ /ssh -o StrictHostKeyChecking=no -l/
15
15
  end
16
16
  it "should have the keypair in the ssh_string" do
17
17
  @tc.ssh_string.should =~ /#{@tc.keypair}/
@@ -21,9 +21,6 @@ describe "Remoter" do
21
21
  it "should have StrictHostKeyChecking set to no" do
22
22
  @tc.ssh_array.include?("-o StrictHostKeyChecking=no").should == true
23
23
  end
24
- it "should have the user set to the base user class" do
25
- @tc.ssh_array.include?("-l '#{Base.user}'").should == true
26
- end
27
24
  it "should have the keypair path in the ssh_array" do
28
25
  @tc.ssh_array.include?('-i "'+@tc.full_keypair_path+'"').should == true
29
26
  end
@@ -34,7 +31,7 @@ describe "Remoter" do
34
31
  @ri.stub!(:ip).and_return "192.168.0.22"
35
32
  end
36
33
  it "should have rsync in the rsync_command" do
37
- @tc.rsync_command.should == "rsync -azP --exclude cache -e '#{@tc.ssh_string}'"
34
+ @tc.rsync_command.should == "rsync -azP --exclude cache -e '#{@tc.ssh_string} -l #{Base.user}'"
38
35
  end
39
36
  it "should be able to rsync storage commands" do
40
37
  @tc.rsync_storage_files_to_command(@ri).should == "#{@tc.rsync_command} #{Base.storage_directory}/ 192.168.0.22:/var/poolparty"
@@ -44,6 +41,7 @@ describe "Remoter" do
44
41
  before(:each) do
45
42
  @tc.stub!(:wait).and_return true
46
43
  stub_list_from_remote_for(@tc)
44
+ stub_remoting_methods_for(@tc)
47
45
  @tc.stub!(:maximum_instances).and_return 5
48
46
  @tc.stub!(:list_of_pending_instances).and_return []
49
47
  @tc.stub!(:list_of_nonterminated_instances).and_return []
@@ -51,9 +49,14 @@ describe "Remoter" do
51
49
  @tc.stub!(:master).and_return ris.first
52
50
  @tc.stub!(:after_launched).and_return true
53
51
  @tc.stub!(:verbose).and_return false
54
- Provisioner.stub!(:provision_master).and_return true
55
- Provisioner.stub!(:reconfigure_master).and_return true
56
- Provisioner.stub!(:clear_master_ssl_certs).and_return true
52
+ ::File.stub!(:exists?).and_return true
53
+
54
+ @pb = PoolParty::Provisioner::Capistrano.new(nil, @tc)
55
+ PoolParty::Provisioner::Capistrano.stub!(:new).and_return @pb
56
+ @pb.stub!(:setup_runner)
57
+ @pb.stub!(:install).and_return true
58
+ @pb.stub!(:configure).and_return true
59
+ @pb.stub!(:create_roles).and_return true
57
60
  end
58
61
  it "should have the method launch_master!" do
59
62
  @tc.respond_to?(:launch_and_configure_master!).should == true
@@ -69,9 +72,6 @@ describe "Remoter" do
69
72
  @tc.stub!(:can_start_a_new_instance?).and_return true
70
73
  @tc.stub!(:is_master_running?).and_return false
71
74
  end
72
- it "should tell the provisioner to provision_master" do
73
- Provisioner.should_receive(:provision_master).once.and_return true
74
- end
75
75
  after(:each) do
76
76
  @tc.launch_and_configure_master!
77
77
  end
@@ -21,7 +21,7 @@ describe "Remote Instance" do
21
21
  @tc.has_git(:at => "/var/www/", :name => "gitrepos.git", :source => "git://source.git").to_string.should =~ /exec/
22
22
  end
23
23
  it "should included the flushed out options" do
24
- @tc.has_git({:name => "git.git", :source => "git://source.git", :user => "finger", :at => "/var/www/"}).to_string.should =~ /finger@git:/
24
+ @tc.has_git({:name => "git.git", :source => "git://source.git", :requires_user => "finger", :at => "/var/www/"}).to_string.should =~ /finger@git:/
25
25
  end
26
26
  it "should not include the user if none is given" do
27
27
  @tc.has_git({:name => "git.git", :source => "git://source.git",:at => "/var/www/"}).to_string.should =~ /git clone git:/
@@ -28,6 +28,6 @@ describe "PoolParty" do
28
28
  end
29
29
  end
30
30
  it "should have a logger" do
31
- PoolParty.logger.should_not be_nil
31
+ PoolParty.log.should_not be_nil
32
32
  end
33
33
  end
@@ -0,0 +1,27 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+
3
+ describe "Capistrano provisioner" do
4
+ before(:each) do
5
+ @cloud = cloud :app do;end
6
+ @remote_instance = PoolParty::Remote::RemoteInstance.new({:ip => "192.168.0.1", :status => "running", :name => "master"}, @cloud)
7
+ stub_list_from_remote_for(@cloud)
8
+ end
9
+ describe "instance" do
10
+ before(:each) do
11
+ @pb = PoolParty::Provisioner::Capistrano.new(@remote_instance, @cloud)
12
+ end
13
+ it "should create the config on the initialize" do
14
+ @pb.config.class.should == ::Capistrano::Configuration
15
+ end
16
+ describe "config" do
17
+ it "should create the config at ::Capistrano::Logger::INFO if the cloud is verbose" do
18
+ @cloud.stub!(:verbose).and_return true
19
+ PoolParty::Provisioner::Capistrano.new(nil, @cloud).config.logger.level.should == ::Capistrano::Logger::INFO
20
+ end
21
+ it "should create the config at ::Capistrano::Logger::IMPORTANT if the cloud is not verbose" do
22
+ @cloud.stub!(:verbose).and_return false
23
+ PoolParty::Provisioner::Capistrano.new(nil, @cloud).config.logger.level.should == ::Capistrano::Logger::IMPORTANT
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,120 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ include Provisioner
4
+
5
+ describe "ProvisionerBase" do
6
+ before(:each) do
7
+ @cloud = cloud :app do;end
8
+ @remote_instance = PoolParty::Remote::RemoteInstance.new({:ip => "192.168.0.1", :status => "running", :name => "master"}, @cloud)
9
+ @pb = PoolParty::Provisioner::ProvisionerBase.new(@remote_instance, @cloud)
10
+ stub_list_from_remote_for(@cloud)
11
+ stub_remoting_methods_for(@cloud)
12
+ end
13
+ describe "class methods" do
14
+ it "should have install" do
15
+ ProvisionerBase.respond_to?(:install).should == true
16
+ end
17
+ it "should have configure" do
18
+ ProvisionerBase.respond_to?(:configure).should == true
19
+ end
20
+ describe "in action" do
21
+ it "should call a new ProvisionerBase" do
22
+ ProvisionerBase.should_receive(:new).with(@remote_instance, @cloud).and_return @pb
23
+ ProvisionerBase.install(@remote_instance, @cloud)
24
+ end
25
+ end
26
+ end
27
+ describe "instance methods" do
28
+ before(:each) do
29
+ @pb = PoolParty::Provisioner::ProvisionerBase.new(@remote_instance, @cloud)
30
+ stub_list_from_remote_for(@pb)
31
+ stub_list_from_remote_for(@cloud)
32
+ stub_remoting_methods_for(@pb)
33
+ end
34
+ it "should store the instance on the ProvisionerBase" do
35
+ @pb.instance.should == @remote_instance
36
+ end
37
+ it "should store the cloud on the ProvisionerBase" do
38
+ @pb.cloud.should == @cloud
39
+ end
40
+ it "should say provision_master? is true if the remote instance name is master" do
41
+ @pb.provision_master?.should == true
42
+ end
43
+ it "should say the provision_master? is false if the remote instance is not the master" do
44
+ @remote_instance.stub!(:master?).and_return false
45
+ @pb.provision_master?.should == false
46
+ end
47
+ it "should say the provision_master? is false if the remote instance is nil" do
48
+ PoolParty::Provisioner::ProvisionerBase.new(nil, @cloud).provision_master?.should == false
49
+ end
50
+ describe "custom tasks" do
51
+ it "should call custom_configure_tasks_for on the cloud with the instance" do
52
+ @cloud.should_receive(:custom_configure_tasks_for).with(@remote_instance).and_return []
53
+ @pb.custom_configure_tasks
54
+ end
55
+ it "should call custom_install_tasks_for on the cloud with the instance" do
56
+ @cloud.should_receive(:custom_install_tasks_for).with(@remote_instance).and_return []
57
+ @pb.custom_install_tasks
58
+ end
59
+ end
60
+ describe "installation" do
61
+ it "should have an install method" do
62
+ @pb.respond_to?(:install).should == true
63
+ end
64
+ it "should call error if it is not valid" do
65
+ @pb.stub!(:valid?).and_return false
66
+ lambda {@pb.install}.should raise_error
67
+ end
68
+ it "should not raise an exception if it is valid" do
69
+ @pb.stub!(:valid?).and_return true
70
+ lambda {@pb.install(true)}.should_not raise_error
71
+ end
72
+ it "should call before_install with the instance" do
73
+ @pb.should_receive(:before_install).with(@remote_instance).and_return true
74
+ @pb.install
75
+ end
76
+ it "should call setup_runner" do
77
+ @pb.should_receive(:setup_runner).and_return true
78
+ @pb.install
79
+ end
80
+ it "should call process_install! with the testing" do
81
+ @pb.should_receive(:process_install!).with(false).and_return true
82
+ @pb.install
83
+ end
84
+ it "should call after_install with the instance" do
85
+ @pb.should_receive(:after_install).with(@remote_instance).and_return true
86
+ @pb.install
87
+ end
88
+ end
89
+ describe "configuration" do
90
+ it "should have a configure method" do
91
+ @pb.respond_to?(:configure).should == true
92
+ end
93
+ it "should call error if it is not valid" do
94
+ @pb.stub!(:valid?).and_return false
95
+ lambda {@pb.configure}.should raise_error
96
+ end
97
+ it "should not raise an exception if it is valid" do
98
+ @pb.stub!(:valid?).and_return true
99
+ lambda {@pb.configure(true)}.should_not raise_error
100
+ end
101
+ it "should call before_configure with the instance" do
102
+ @pb.should_receive(:before_configure).with(@remote_instance).and_return true
103
+ @pb.configure
104
+ end
105
+ it "should call setup_runner" do
106
+ @pb.should_receive(:setup_runner).and_return true
107
+ @pb.configure
108
+ end
109
+ it "should call process_configure! with the testing" do
110
+ @pb.should_receive(:process_configure!).with(false).and_return true
111
+ @pb.configure
112
+ end
113
+ it "should call after_configure with the instance" do
114
+ @pb.should_receive(:after_configure).with(@remote_instance).and_return true
115
+ @pb.configure
116
+ end
117
+
118
+ end
119
+ end
120
+ end
@@ -104,8 +104,22 @@ def stub_list_from_remote_for(o, launch_stub=true)
104
104
  # o.stub!(:master).and_return @ris[0]
105
105
  o.stub!(:launch_new_instance!).and_return sample_instances.first if launch_stub
106
106
  stub_list_of_instances_for(o)
107
+ stub_remoting_methods_for(o)
108
+ end
109
+ def stub_remoting_methods_for(o)
110
+ o.stub!(:keypair).and_return "fake_keypair"
111
+ o.stub!(:keypair_path).and_return "~/.ec2/fake_keypair"
112
+ o.stub!(:other_clouds).and_return []
113
+ o.stub!(:expand_when).and_return "cpu > 10"
114
+ o.stub!(:copy_file_to_storage_directory).and_return true
115
+ o.stub!(:rsync_storage_files_to).and_return true
116
+ o.stub!(:minimum_runnable_options).and_return []
117
+ o.stub!(:build_and_store_new_config_file).and_return true
118
+ o.stub!(:process_clean_reconfigure_for!).and_return true
119
+ o.stub!(:before_install).and_return true
120
+ o.stub!(:process_install).and_return true
121
+ o.stub!(:after_install).and_return true
107
122
  end
108
-
109
123
  def stub_list_of_instances_for(o)
110
124
  # o.stub!(:list_of_running_instances).once.and_return running_remote_instances
111
125
  o.stub!(:keypair).and_return "fake_keypair"
data/website/index.html CHANGED
@@ -34,7 +34,7 @@
34
34
  <h1>PoolParty</h1>
35
35
  <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/poolparty"; return false'>
36
36
  <p>Get Version</p>
37
- <a href="http://rubyforge.org/projects/poolparty" class="numbers">0.2.81</a>
37
+ <a href="http://rubyforge.org/projects/poolparty" class="numbers">0.2.83</a>
38
38
  </div>
39
39
  <h1>&#8216;Easy cloud computing&#8217;</h1>
40
40
  <h2>What</h2>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auser-poolparty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.81
4
+ version: 0.2.84
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-10 00:00:00 -08:00
12
+ date: 2008-12-13 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-setup-dev
73
74
  - cloud-spec
74
75
  - cloud-ssh
75
76
  - cloud-start
@@ -99,6 +100,7 @@ executables:
99
100
  - server-stop-master
100
101
  - server-stop-node
101
102
  - server-update-hosts
103
+ - server-write-new-nodes
102
104
  extensions: []
103
105
 
104
106
  extra_rdoc_files:
@@ -111,6 +113,7 @@ extra_rdoc_files:
111
113
  - lib/poolparty/config/postlaunchmessage.txt
112
114
  - website/index.txt
113
115
  files:
116
+ - Capfile
114
117
  - History.txt
115
118
  - License.txt
116
119
  - Manifest.txt
@@ -131,6 +134,7 @@ files:
131
134
  - bin/cloud-refresh
132
135
  - bin/cloud-rsync
133
136
  - bin/cloud-run
137
+ - bin/cloud-setup-dev
134
138
  - bin/cloud-spec
135
139
  - bin/cloud-ssh
136
140
  - bin/cloud-start
@@ -160,6 +164,7 @@ files:
160
164
  - bin/server-stop-master
161
165
  - bin/server-stop-node
162
166
  - bin/server-update-hosts
167
+ - bin/server-write-new-nodes
163
168
  - config/hoe.rb
164
169
  - config/requirements.rb
165
170
  - examples/basic.rb
@@ -286,6 +291,7 @@ files:
286
291
  - lib/poolparty/base_packages/poolparty.rb
287
292
  - lib/poolparty/base_packages/ruby.rb
288
293
  - lib/poolparty/base_packages/runit.rb
294
+ - lib/poolparty/capistrano.rb
289
295
  - lib/poolparty/config/postlaunchmessage.txt
290
296
  - lib/poolparty/core/array.rb
291
297
  - lib/poolparty/core/class.rb
@@ -306,6 +312,7 @@ files:
306
312
  - lib/poolparty/exceptions/CloudNotFoundException.rb
307
313
  - lib/poolparty/exceptions/LoadRulesException.rb
308
314
  - lib/poolparty/exceptions/MasterException.rb
315
+ - lib/poolparty/exceptions/ProvisionerException.rb
309
316
  - lib/poolparty/exceptions/RemoteException.rb
310
317
  - lib/poolparty/exceptions/ResourceException.rb
311
318
  - lib/poolparty/exceptions/RuntimeException.rb
@@ -374,10 +381,12 @@ files:
374
381
  - lib/poolparty/poolparty/resources/symlink.rb
375
382
  - lib/poolparty/poolparty/resources/variable.rb
376
383
  - lib/poolparty/poolparty/script.rb
384
+ - lib/poolparty/provisioners/capistrano/capistrano.rb
385
+ - lib/poolparty/provisioners/capistrano/capistrano_configurer.rb
386
+ - lib/poolparty/provisioners/capistrano/recipies/base.rb
387
+ - lib/poolparty/provisioners/capistrano/recipies/master.rb
388
+ - lib/poolparty/provisioners/capistrano/recipies/slave.rb
377
389
  - lib/poolparty/provisioners/provisioner_base.rb
378
- - lib/poolparty/provisioners/provisioners/become_master.rb
379
- - lib/poolparty/provisioners/provisioners/master.rb
380
- - lib/poolparty/provisioners/provisioners/slave.rb
381
390
  - lib/poolparty/spec/core/string.rb
382
391
  - lib/poolparty/spec/matchers/a_spec_extensions_base.rb
383
392
  - lib/poolparty/spec/matchers/have_cron.rb
@@ -445,9 +454,6 @@ files:
445
454
  - spec/poolparty/helpers/binary_spec.rb
446
455
  - spec/poolparty/helpers/display_spec.rb
447
456
  - spec/poolparty/helpers/optioner_spec.rb
448
- - spec/poolparty/helpers/provisioner_base_spec.rb
449
- - spec/poolparty/helpers/provisioners/master_spec.rb
450
- - spec/poolparty/helpers/provisioners/slave_spec.rb
451
457
  - spec/poolparty/modules/cloud_resourcer_spec.rb
452
458
  - spec/poolparty/modules/configurable_spec.rb
453
459
  - spec/poolparty/modules/definable_resource.rb
@@ -456,6 +462,7 @@ files:
456
462
  - spec/poolparty/monitors/base_monitor_spec.rb
457
463
  - spec/poolparty/monitors/monitors/cpu_monitor_spec.rb
458
464
  - spec/poolparty/monitors/monitors/memory_monitor_spec.rb
465
+ - spec/poolparty/net/log/pool.log
459
466
  - spec/poolparty/net/messenger_spec.rb
460
467
  - spec/poolparty/net/remote_bases/ec2_spec.rb
461
468
  - spec/poolparty/net/remote_instance_spec.rb
@@ -497,6 +504,8 @@ files:
497
504
  - spec/poolparty/poolparty/test_plugins/virtual_host_template.erb
498
505
  - spec/poolparty/poolparty/test_plugins/webserver.rb
499
506
  - spec/poolparty/poolparty_spec.rb
507
+ - spec/poolparty/provisioners/capistrano/capistrano_spec.rb
508
+ - spec/poolparty/provisioners/provisioner_base_spec.rb
500
509
  - spec/poolparty/spec/core/string_spec.rb
501
510
  - spec/poolparty/spec_helper.rb
502
511
  - tasks/cloud.rake
@@ -521,7 +530,7 @@ files:
521
530
  has_rdoc: true
522
531
  homepage: http://poolparty.rubyforge.org
523
532
  post_install_message: |-
524
- Get ready to jump in the pool, you just installed PoolParty! (Updated at 13:44 12/10/08)
533
+ Get ready to jump in the pool, you just installed PoolParty! (Updated at 19:18 12/13/08)
525
534
 
526
535
  To get started, run the generator:
527
536
 
@@ -1,166 +0,0 @@
1
- module PoolParty
2
- module Provisioner
3
- class BecomeMaster < ProvisionerBase
4
-
5
- def initialize(cl=self, os=:ubuntu)
6
- raise MasterException.new(:no_ip) unless cl.master && cl.master.ip
7
- super(cl.master, cl, os)
8
- @master_ip = cl.master.ip
9
- end
10
-
11
- def valid?
12
- !(@cloud.nil? || @cloud.master.nil?)
13
- end
14
-
15
- def error
16
- raise RemoteException.new(:could_not_install, "Your cloud does not have a master")
17
- end
18
-
19
- def first_install_tasks
20
- [
21
- create_local_hosts_entry
22
- ]
23
- end
24
-
25
- def install_tasks
26
- [
27
- setup_basic_structure,
28
- setup_configs,
29
- setup_fileserver,
30
- setup_autosigning,
31
- restart_puppetmaster,
32
- run_first_time,
33
- create_local_node,
34
- ] << configure_tasks
35
- end
36
-
37
- def configure_tasks
38
- [
39
- create_local_node,
40
- move_templates,
41
- setup_poolparty,
42
- create_poolparty_manifest,
43
- restart_puppetd
44
- ]
45
- end
46
-
47
- # If the master is not in the hosts file, then add it to the hosts file
48
- def create_local_hosts_entry
49
- <<-EOS
50
- echo "Creating local host entry"
51
- if [ -z \"$(grep -v '#' /etc/hosts | grep 'puppet')" ]; then echo '#{@master_ip} master puppet localhost' >> /etc/hosts; fi
52
- hostname master
53
- EOS
54
- end
55
-
56
- def setup_basic_structure
57
- <<-EOS
58
- echo "Creating basic structure for poolparty"
59
- mkdir -p /etc/puppet/manifests/nodes
60
- mkdir -p /etc/puppet/manifests/classes
61
- echo "import 'nodes/*.pp'" > /etc/puppet/manifests/site.pp
62
- echo "import 'classes/*.pp'" >> /etc/puppet/manifests/site.pp
63
- cp #{Base.remote_storage_path}/namespaceauth.conf /etc/puppet/namespaceauth.conf
64
- EOS
65
- end
66
-
67
- def setup_configs
68
- <<-EOS
69
- echo "Setting up configuration"
70
- cp #{Base.remote_storage_path}/puppet.conf /etc/puppet/puppet.conf
71
- EOS
72
- end
73
-
74
- def setup_fileserver
75
- <<-EOS
76
- echo "Setting up the master fileserver"
77
- echo "
78
- [files]
79
- path #{Base.remote_storage_path}
80
- allow *" > /etc/puppet/fileserver.conf
81
- mkdir -p /var/poolparty/facts
82
- mkdir -p /var/poolparty/files
83
- mkdir -p /etc/poolparty
84
- EOS
85
- end
86
- # Change this eventually for better security supportsetup_fileserver
87
- def setup_autosigning
88
- <<-EOS
89
- echo "Creating accessibility for the nodes"
90
- echo "*" > /etc/puppet/autosign.conf
91
- EOS
92
- end
93
-
94
- def setup_poolparty
95
- <<-EOS
96
- echo "Setting the poolparty configuration"
97
- cp #{Base.remote_storage_path}/#{Base.key_file_locations.first} "#{Base.base_config_directory}/.ppkeys"
98
- mv #{Base.remote_storage_path}/#{Base.default_specfile_name} #{Base.base_config_directory}/
99
- EOS
100
- end
101
-
102
- def copy_ssh_app
103
- "cp #{Base.remote_storage_path}/#{@cloud.full_keypair_name} #{@cloud.remote_keypair_path}" if @cloud.remote_keypair_path != "#{Base.remote_storage_path}/#{@cloud.full_keypair_name}"
104
- end
105
-
106
- # /etc/init.d/puppetmaster stop; rm -rf /etc/puppet/ssl; /etc/init.d/puppetmaster start
107
- # ps aux | grep puppetmaster | grep -v grep | awk '{print $2}' | xargs kill;
108
- def restart_puppetmaster
109
- <<-EOS
110
- echo "(Re)starting poolparty"
111
- . /etc/profile
112
- /etc/init.d/puppetmaster stop;rm -rf /etc/poolparty/ssl;puppetmasterd --verbose;/etc/init.d/puppetmaster start
113
- EOS
114
- end
115
-
116
- def run_first_time
117
- <<-EOE
118
- echo "Running first time run"
119
- cp #{Base.remote_storage_path}/#{Base.template_directory}/puppetrunner /usr/bin/puppetrunner
120
- chmod +x /usr/bin/puppetrunner
121
- EOE
122
- end
123
-
124
- # TODO:
125
- # Consider this method in the manifest
126
- def create_local_node
127
- str = <<-EOS
128
- node default {
129
- include poolparty
130
- }
131
- EOS
132
- @cloud.list_of_running_instances.each do |ri|
133
- str << <<-EOS
134
- node "#{ri.name}" inherits default {}
135
- EOS
136
- end
137
- "echo '#{str}' > #{Base.manifest_path}/nodes/nodes.pp"
138
- end
139
-
140
- def move_templates
141
- <<-EOS
142
- echo "Moving templates into place"
143
- mkdir -p #{Base.template_path}
144
- cp -R #{Base.remote_storage_path}/#{Base.template_directory}/* #{Base.template_path}
145
- EOS
146
- end
147
-
148
- def create_poolparty_manifest
149
- <<-EOS
150
- echo "Creating the manifest"
151
- cp #{Base.remote_storage_path}/poolparty.pp /etc/puppet/manifests/classes/poolparty.pp
152
- #{copy_ssh_app}
153
- EOS
154
- end
155
-
156
- def restart_puppetd
157
- # /usr/bin/puppetrerun
158
- # /usr/bin/puppetcleaner master
159
- <<-EOS
160
- echo "Running puppet manifest"
161
- /usr/bin/puppetrerun
162
- EOS
163
- end
164
- end
165
- end
166
- end