auser-poolparty 0.2.44 → 0.2.45

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 (48) hide show
  1. data/Manifest.txt +3 -1
  2. data/bin/cloud +11 -21
  3. data/bin/cloud-add-keypair +18 -13
  4. data/bin/cloud-configure +3 -11
  5. data/bin/cloud-contract +7 -12
  6. data/bin/cloud-ensure-provisioning +2 -11
  7. data/bin/cloud-expand +3 -10
  8. data/bin/cloud-handle-load +3 -9
  9. data/bin/cloud-list +3 -9
  10. data/bin/cloud-maintain +2 -9
  11. data/bin/cloud-osxcopy +3 -9
  12. data/bin/cloud-provision +4 -9
  13. data/bin/cloud-refresh +2 -9
  14. data/bin/cloud-run +3 -4
  15. data/bin/cloud-ssh +3 -2
  16. data/bin/cloud-start +7 -13
  17. data/bin/cloud-terminate +4 -7
  18. data/bin/pool +11 -12
  19. data/bin/pool-describe +0 -1
  20. data/bin/pool-list +3 -9
  21. data/bin/pool-start +3 -10
  22. data/generators/poolspec/USAGE +2 -2
  23. data/generators/poolspec/poolspec_generator.rb +2 -1
  24. data/generators/poolspec/templates/pool_spec_template.erb +3 -2
  25. data/lib/erlang/messenger/useful_snippets +2 -2
  26. data/lib/poolparty/aska/aska.rb +5 -6
  27. data/lib/poolparty/base_packages/haproxy.rb +2 -2
  28. data/lib/poolparty/core/string.rb +1 -1
  29. data/lib/poolparty/exceptions/CloudNotFoundException.rb +7 -0
  30. data/lib/poolparty/helpers/binary.rb +1 -1
  31. data/lib/poolparty/helpers/optioner.rb +34 -12
  32. data/lib/poolparty/modules/cloud_dsl.rb +13 -0
  33. data/lib/poolparty/net/messenger.rb +1 -1
  34. data/lib/poolparty/net/remote_bases/ec2.rb +162 -145
  35. data/lib/poolparty/net/remoter.rb +8 -4
  36. data/lib/poolparty/plugins/git.rb +5 -1
  37. data/lib/poolparty/pool/base.rb +1 -1
  38. data/lib/poolparty/pool/cloud.rb +7 -2
  39. data/lib/poolparty/pool/resource.rb +1 -1
  40. data/lib/poolparty/pool/resources/mount.rb +22 -0
  41. data/lib/poolparty/version.rb +1 -1
  42. data/poolparty.gemspec +5 -4
  43. data/spec/poolparty/modules/configurable_spec.rb +4 -1
  44. data/spec/poolparty/pool/base_spec.rb +2 -2
  45. data/spec/poolparty/pool/plugin_model_spec.rb +2 -3
  46. data/website/index.html +1 -1
  47. metadata +5 -4
  48. data/bin/pool-provision +0 -34
@@ -174,15 +174,19 @@ module PoolParty
174
174
  end
175
175
 
176
176
  def provision_slaves_from_n(num=1)
177
+ vputs "In provision_slaves_from_n: #{num}"
177
178
  reset!
178
179
  when_no_pending_instances do
180
+ vputs "Waiting for 10 seconds"
179
181
  wait "10.seconds" # Give some time for ssh to startup
180
182
  @num_instances = list_of_running_instances.size
181
183
  vputs "(@num_instances - (num))..(@num_instances): #{(@num_instances - (num))..(@num_instances)}"
182
184
  last_instances = nonmaster_nonterminated_instances[(@num_instances - (num))..(@num_instances)]
183
185
  last_instances.each do |inst|
184
- PoolParty::Provisioner.provision_slave(inst, self, false) unless inst.master?
186
+ vputs "Provision slave: #{inst}"
187
+ PoolParty::Provisioner.provision_slave(inst, self, false) unless inst.master? rescue vputs "Error"
185
188
  cmd = ". /etc/profile && cloud-provision -i #{inst.name.gsub(/node/, '')} #{unix_hide_string} &"
189
+ vputs "Provision slave with command #{cmd}"
186
190
  Kernel.system cmd
187
191
  end
188
192
  PoolParty::Provisioner.reconfigure_master(self)
@@ -215,11 +219,11 @@ module PoolParty
215
219
  end
216
220
  # Stub method for the time being to handle expansion of the cloud
217
221
  def should_expand_cloud?(force=false)
218
- valid_rules?(:expansions) || force || false
222
+ valid_rules?(:expand_when) || force || false
219
223
  end
220
224
  # Stub method for the time being to handle the contraction of the cloud
221
225
  def should_contract_cloud?(force=false)
222
- valid_rules?(:contractions) || force || false
226
+ valid_rules?(:contract_when) || force || false
223
227
  end
224
228
  # Expand the cloud
225
229
  # If we can start a new instance and the load requires us to expand
@@ -229,7 +233,7 @@ module PoolParty
229
233
  # get go
230
234
  def expand_cloud_if_necessary(force=false)
231
235
  if can_start_a_new_instance? && should_expand_cloud?(force)
232
- logger.debug "Expanding the cloud based on load"
236
+ vputs "Expanding the cloud based on load"
233
237
  @num = 1
234
238
  request_launch_new_instances(@num)
235
239
 
@@ -9,7 +9,6 @@ module PoolParty
9
9
 
10
10
  def has_git_repos
11
11
  has_package(:name => "git-core")
12
- has_directory(:name => "#{cwd}")
13
12
 
14
13
  has_exec({:name => "git-#{name}", :requires => get_package("git-core"), :requires => [get_directory("#{cwd}"), get_package("git-core")]}) do
15
14
  command parent.user ? "git clone #{parent.user}@#{parent.source} #{parent.path}" : "git clone #{parent.source} #{parent.to ? parent.to : ""}"
@@ -22,6 +21,11 @@ module PoolParty
22
21
  end
23
22
  end
24
23
 
24
+ def at(dir)
25
+ cwd dir
26
+ has_directory(:name => "#{dir}", :requires => "#{::File.dirname(dir)}")
27
+ end
28
+
25
29
  # Since git is not a native type, we have to say which core resource
26
30
  # it is using to be able to require it
27
31
  def class_type_name
@@ -39,7 +39,7 @@ module PoolParty
39
39
  ENV["AWS_ACCESS_KEY_ID"] ? ENV["AWS_ACCESS_KEY_ID"] : load_keys_from_file[:access_key]
40
40
  end
41
41
  def secret_access_key
42
- ENV["AWS_SECRET_ACCESS_ID"] ? ENV["AWS_SECRET_ACCESS_ID"] : load_keys_from_file[:secret_access_key]
42
+ ENV["AWS_SECRET_ACCESS_KEY"] ? ENV["AWS_SECRET_ACCESS_KEY"] : load_keys_from_file[:secret_access_key]
43
43
  end
44
44
  def read_keyfile
45
45
  open(get_working_key_file_locations).read
@@ -12,7 +12,8 @@ module PoolParty
12
12
  end
13
13
 
14
14
  def with_cloud(cl, opts={}, &block)
15
- cl.options.merge!(opts)
15
+ raise CloudNotFoundException.new("Cloud not found") unless cl
16
+ cl.options.merge!(opts) if opts
16
17
  cl.instance_eval &block if block
17
18
  end
18
19
 
@@ -27,6 +28,7 @@ module PoolParty
27
28
  # Net methods
28
29
  include PoolParty::Remote::RemoterBase
29
30
  include Remote
31
+ include PoolParty::CloudDsl
30
32
 
31
33
  default_options({
32
34
  :minimum_instances => 2,
@@ -156,7 +158,10 @@ module PoolParty
156
158
  # they need a few options to run, these are the required options
157
159
  # to be saved on the remote "master" machine
158
160
  def minimum_runnable_options
159
- [:keypair, :minimum_instances, :maximum_instances, :ami, :expand_when, :contract_when]
161
+ [
162
+ :keypair, :minimum_instances, :maximum_instances, :ami,
163
+ :expand_when, :contract_when, :set_master_ip_to
164
+ ]
160
165
  end
161
166
 
162
167
  # Add all the poolparty requirements here
@@ -167,7 +167,7 @@ module PoolParty
167
167
  [
168
168
  :subscribe, :owner, :group, :path, :mode, :source, :notify, :subscribe, :check, :creates, :cwd, :command, :ensure,
169
169
  :require, :schedule, :range, :alias, :hour, :minute, :user, :month, :monthday, :name, :onlyif, :unless, :refreshonly,
170
- :refresh, :content, :template, :ip, :repeat, :provider, :key
170
+ :refresh, :content, :template, :ip, :repeat, :provider, :key, :device, :fstype, :remounts, :options, :atboot
171
171
  ]
172
172
  end
173
173
  def key
@@ -0,0 +1,22 @@
1
+ module PoolParty
2
+ module Resources
3
+
4
+ class Mount < Resource
5
+
6
+ default_options({
7
+ :name => "/data",
8
+ :remounts => "true",
9
+ :options => "rw,nosuid,noquota",
10
+ :fstype => "xfs",
11
+ :atboot => "yes"
12
+ })
13
+
14
+ def disallowed_options
15
+ [:name]
16
+ end
17
+
18
+
19
+ end
20
+
21
+ end
22
+ end
@@ -2,7 +2,7 @@ module PoolParty
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- TINY = 44
5
+ TINY = 45
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
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.44
4
+ version: 0.2.45
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-11-04 00:00:00 -08:00
12
+ date: 2008-11-05 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -77,7 +77,6 @@ executables:
77
77
  - pool-console
78
78
  - pool-describe
79
79
  - pool-list
80
- - pool-provision
81
80
  - pool-spec
82
81
  - pool-start
83
82
  - server-build-messenger
@@ -128,7 +127,6 @@ files:
128
127
  - bin/pool-console
129
128
  - bin/pool-describe
130
129
  - bin/pool-list
131
- - bin/pool-provision
132
130
  - bin/pool-spec
133
131
  - bin/pool-start
134
132
  - bin/server-build-messenger
@@ -414,6 +412,7 @@ files:
414
412
  - lib/poolparty/core/time.rb
415
413
  - lib/poolparty/dependency_resolutions/base.rb
416
414
  - lib/poolparty/dependency_resolutions/puppet.rb
415
+ - lib/poolparty/exceptions/CloudNotFoundException.rb
417
416
  - lib/poolparty/exceptions/LoadRulesException.rb
418
417
  - lib/poolparty/exceptions/MasterException.rb
419
418
  - lib/poolparty/exceptions/RemoteException.rb
@@ -429,6 +428,7 @@ files:
429
428
  - lib/poolparty/helpers/provisioner_base.rb
430
429
  - lib/poolparty/helpers/provisioners/master.rb
431
430
  - lib/poolparty/helpers/provisioners/slave.rb
431
+ - lib/poolparty/modules/cloud_dsl.rb
432
432
  - lib/poolparty/modules/cloud_resourcer.rb
433
433
  - lib/poolparty/modules/configurable.rb
434
434
  - lib/poolparty/modules/definable_resource.rb
@@ -468,6 +468,7 @@ files:
468
468
  - lib/poolparty/pool/resources/file.rb
469
469
  - lib/poolparty/pool/resources/gem_package.rb
470
470
  - lib/poolparty/pool/resources/host.rb
471
+ - lib/poolparty/pool/resources/mount.rb
471
472
  - lib/poolparty/pool/resources/package.rb
472
473
  - lib/poolparty/pool/resources/remote_file.rb
473
474
  - lib/poolparty/pool/resources/service.rb
@@ -9,7 +9,6 @@ describe "configurable" do
9
9
  @tc = TestClass.new
10
10
  end
11
11
  it "should set the name as frank" do
12
- @tc.name.should == nil
13
12
  @tc.configure({:name => "frank"})
14
13
  @tc.name.should == "frank"
15
14
  end
@@ -23,4 +22,8 @@ describe "configurable" do
23
22
  @tc.reconfigure(:name => "dewey")
24
23
  @tc.name.should == "dewey"
25
24
  end
25
+ it "should send an array if two arguments are given" do
26
+ @tc.configure({:name => ["array", "ishere"]})
27
+ @tc.name.should == ["array", "ishere"]
28
+ end
26
29
  end
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../spec_helper'
3
3
  describe "Base" do
4
4
  before(:each) do
5
5
  ENV.stub!(:[]).with("AWS_ACCESS_KEY_ID").and_return "KEY"
6
- ENV.stub!(:[]).with("AWS_SECRET_ACCESS_ID").and_return "SECRET"
6
+ ENV.stub!(:[]).with("AWS_SECRET_ACCESS_KEY").and_return "SECRET"
7
7
  end
8
8
  it "should set the environment, if not set to production" do
9
9
  Base.environment.should == "production"
@@ -77,7 +77,7 @@ describe "Base" do
77
77
  before(:each) do
78
78
  Base.stub!(:get_working_key_file_locations).and_return nil
79
79
  ENV.stub!(:[]).with("AWS_ACCESS_KEY_ID").and_return nil
80
- ENV.stub!(:[]).with("AWS_SECRET_ACCESS_ID").and_return nil
80
+ ENV.stub!(:[]).with("AWS_SECRET_ACCESS_KEY").and_return nil
81
81
  Base.reset!
82
82
  end
83
83
  it "should render the access_key nil" do
@@ -3,7 +3,6 @@ require File.dirname(__FILE__) + '/test_plugins/webserver'
3
3
 
4
4
  describe "Plugin" do
5
5
  before(:each) do
6
- setup
7
6
  @p = pool :poolpartyrb do
8
7
  cloud :app do
9
8
  apache do
@@ -56,8 +55,8 @@ describe "Plugin" do
56
55
  @plugin.respond_to?(:site).should == true
57
56
  end
58
57
  it "should be able to call the plugin method site" do
59
- @plugin.should_receive(:virtual_host).once
60
- @plugin.site("hi", {:document_root => "/root"})
58
+ @plugin.should_receive(:virtual_host).with("hop", {:document_root => "/root"})
59
+ @plugin.virtual_host("hop", {:document_root => "/root"})
61
60
  end
62
61
  end
63
62
  end
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.44</a>
37
+ <a href="http://rubyforge.org/projects/poolparty" class="numbers">0.2.45</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.44
4
+ version: 0.2.45
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-11-04 00:00:00 -08:00
12
+ date: 2008-11-05 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -77,7 +77,6 @@ executables:
77
77
  - pool-console
78
78
  - pool-describe
79
79
  - pool-list
80
- - pool-provision
81
80
  - pool-spec
82
81
  - pool-start
83
82
  - server-build-messenger
@@ -128,7 +127,6 @@ files:
128
127
  - bin/pool-console
129
128
  - bin/pool-describe
130
129
  - bin/pool-list
131
- - bin/pool-provision
132
130
  - bin/pool-spec
133
131
  - bin/pool-start
134
132
  - bin/server-build-messenger
@@ -414,6 +412,7 @@ files:
414
412
  - lib/poolparty/core/time.rb
415
413
  - lib/poolparty/dependency_resolutions/base.rb
416
414
  - lib/poolparty/dependency_resolutions/puppet.rb
415
+ - lib/poolparty/exceptions/CloudNotFoundException.rb
417
416
  - lib/poolparty/exceptions/LoadRulesException.rb
418
417
  - lib/poolparty/exceptions/MasterException.rb
419
418
  - lib/poolparty/exceptions/RemoteException.rb
@@ -429,6 +428,7 @@ files:
429
428
  - lib/poolparty/helpers/provisioner_base.rb
430
429
  - lib/poolparty/helpers/provisioners/master.rb
431
430
  - lib/poolparty/helpers/provisioners/slave.rb
431
+ - lib/poolparty/modules/cloud_dsl.rb
432
432
  - lib/poolparty/modules/cloud_resourcer.rb
433
433
  - lib/poolparty/modules/configurable.rb
434
434
  - lib/poolparty/modules/definable_resource.rb
@@ -468,6 +468,7 @@ files:
468
468
  - lib/poolparty/pool/resources/file.rb
469
469
  - lib/poolparty/pool/resources/gem_package.rb
470
470
  - lib/poolparty/pool/resources/host.rb
471
+ - lib/poolparty/pool/resources/mount.rb
471
472
  - lib/poolparty/pool/resources/package.rb
472
473
  - lib/poolparty/pool/resources/remote_file.rb
473
474
  - lib/poolparty/pool/resources/service.rb
data/bin/pool-provision DELETED
@@ -1,34 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # $:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
3
- # require "poolparty"
4
- # require "poolpartycl"
5
- #
6
- # o = PoolParty::Optioner.new(ARGV) do |opts, optioner|
7
- # opts.on('-t', '--type [master|slave|all]', 'Provision these instances (default: all)') { |o| optioner.class_type o }
8
- # opts.on('-a', '--all', 'Provision all the instances') { |o| optioner.all true }
9
- # opts.on('-n [name]', '--name [name]', 'Pool to provision (required)') {|o| optioner.cloud_name o }
10
- # end
11
- # load_pool(o.spec || Binary.get_existing_spec_location)
12
- #
13
- # if o.cloud_name
14
- # @c = cloud(o.cloud_name.downcase.to_sym)
15
- # else
16
- # puts "Cloud name required. Please specify it with -c [name]"
17
- # exit(0)
18
- # end
19
- #
20
- # if o.class_type && o.class_type != "all" && !o.all
21
- # case o.class_type
22
- # when "master","m"
23
- # puts header("Provisioning the master instances")
24
- # when "slave", "s"
25
- # puts header("Provisioning the slave instances")
26
- # end
27
- # else
28
- # # Provision all the instances
29
- # puts header("Provisioning all the instances")
30
- # provisioner_file = ::File.join(Base.storage_directory, "install.sh")
31
- # File.open(provisioner_file, "w+") do |file|
32
- # file << Provisioner::Master.install(@c)
33
- # end
34
- # end