auser-poolparty 0.2.90 → 0.2.91

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest.txt CHANGED
@@ -276,6 +276,7 @@ lib/poolparty/provisioners/capistrano/recipies/base.rb
276
276
  lib/poolparty/provisioners/capistrano/recipies/master.rb
277
277
  lib/poolparty/provisioners/capistrano/recipies/slave.rb
278
278
  lib/poolparty/provisioners/provisioner_base.rb
279
+ lib/poolparty/spec.rb
279
280
  lib/poolparty/spec/core/string.rb
280
281
  lib/poolparty/spec/matchers/a_spec_extensions_base.rb
281
282
  lib/poolparty/spec/matchers/have_cron.rb
@@ -319,7 +320,6 @@ lib/poolparty/templates/puppetrunner
319
320
  lib/poolparty/templates/yaws.conf
320
321
  lib/poolparty/version.rb
321
322
  lib/poolpartycl.rb
322
- lib/poolpartyspec.rb
323
323
  log/pool.log
324
324
  poolparty.gemspec
325
325
  script/destroy
data/PostInstall.txt CHANGED
@@ -1,4 +1,4 @@
1
- Get ready to jump in the pool, you just installed PoolParty! (Updated at 13:28 12/18/08)
1
+ Get ready to jump in the pool, you just installed PoolParty! (Updated at 00:13 12/21/08)
2
2
 
3
3
  To get started, run the generator:
4
4
 
data/README.txt CHANGED
@@ -39,15 +39,14 @@ COMING SOON
39
39
  sudo gem install auser-poolparty
40
40
 
41
41
  == TODO:
42
- * Rewrite the disallowed_options to whitelist allowed_options on resources
42
+ * Update hot reloading of puppet (force-reload?)
43
43
  * Add pingback for nodes to master when failure occurs
44
44
  * Add become master for the nodes
45
- * Add soft-stop to haproxy while reconfiguring
45
+ * Add hot reload to haproxy while reconfiguring
46
46
  * Replace services with Runit
47
- * Add more granular spec helpers
48
47
  * Refactor provisioning to use erlang
49
48
  * Add queuing of tasks on the messenger
50
- * Add list of latest loads to the messenger
49
+ * Add syntax checker on the manifests
51
50
 
52
51
  == LICENSE:
53
52
 
@@ -11,13 +11,13 @@ o.loaded_clouds.each do |cloud|
11
11
 
12
12
  with_cloud(cloud) do
13
13
  vputs header("Load handling cloud #{name}")
14
- vputs "should_expand_cloud: #{should_contract_cloud?}"
15
- if should_expand_cloud?
14
+ vputs "can_expand_cloud: #{can_contract_cloud?}"
15
+ if can_expand_cloud?
16
16
  vputs "Expanding cloud based on load"
17
17
  log.debug "Expanding cloud based on load"
18
18
  log.debug rules_values
19
19
  expand_cloud_if_necessary
20
- elsif should_contract_cloud?
20
+ elsif can_contract_cloud?
21
21
  vputs "Contracting cloud based on load"
22
22
  log.debug rules_values
23
23
  contract_cloud_if_necessary
@@ -24,5 +24,5 @@ EOE
24
24
  vputs "** Building messenger **", o
25
25
  vputs "Running command #{cmd.runnable}", o
26
26
 
27
- beams_not_running = %x[ps aux | grep beam | grep master].nil?
27
+ beams_not_running = %x[ps aux | grep beam | grep master | grep -v grep].empty?
28
28
  out = %x[#{cmd.runnable}] if beams_not_running
@@ -23,7 +23,9 @@ module PoolParty
23
23
  has_line_in_file("SYSLOGD=\"-r\"", "/etc/default/syslogd")
24
24
  has_line_in_file("local0.* /var/log/haproxy.log", "/etc/syslog.conf", {:notify => get_service("sysklogd")})
25
25
 
26
- has_exec(:name => "reloadhaproxy", :command => "/etc/init.d/haproxy reload", :requires => get_package("haproxy"))
26
+ has_exec(:name => "reloadhaproxy",
27
+ :command => "/etc/init.d/haproxy reload",
28
+ :requires => get_package("haproxy"))
27
29
  # Service is required
28
30
  has_service(:name => "haproxy", :ensures => "running", :hasrestart => true, :notify => get_exec("reloadhaproxy"))
29
31
 
@@ -80,13 +80,13 @@ class Object
80
80
  meta_undef name rescue ""
81
81
  end
82
82
  def vputs(m="", o=self)
83
- puts m if o.verbose
84
- end
85
- def dputs(m="", o=self)
86
- vputs(">#{::File.basename(__FILE__)} (#{__LINE__}) #{m}", o)
83
+ puts m if o.verbose rescue ""
87
84
  end
88
85
  def vprint(m="", o=self)
89
- print m if o.verbose
86
+ print m if o.verbose rescue ""
87
+ end
88
+ def dputs(m="", o=self)
89
+ puts m if o.debugging rescue ""
90
90
  end
91
91
  def unix_hide_string
92
92
  "2>&1 > /dev/null"
@@ -25,12 +25,14 @@ module PoolParty
25
25
  # Generic to_s
26
26
  # Most Resources won't need to extend this
27
27
  def to_string(pre="")
28
+ return "" if printed?
28
29
  opts = get_modified_options
30
+
29
31
  returning Array.new do |output|
30
32
  unless cancelled?
31
33
  output << @prestring || ""
32
34
 
33
- if resources && !resources.empty?
35
+ if resources && !resources.empty?
34
36
  output << resources_string_from_resources(resources, pre)
35
37
  end
36
38
 
@@ -39,13 +41,15 @@ module PoolParty
39
41
  output << opts.flush_out("#{pre*2}").join(",\n")
40
42
  output << "#{pre}}"
41
43
  end
42
-
44
+
45
+ printed
43
46
  output << @poststring || ""
44
47
  end
45
48
  end.join("\n")
46
49
  end
47
50
 
48
51
  def resources_string_from_resources(res, pre="\t")
52
+ return nil if res.keys == [:classpackage] && res.size == 1
49
53
  @variables = res.extract! {|name,resource| name == :variable}
50
54
 
51
55
  returning Array.new do |str|
@@ -3,7 +3,8 @@ module PoolParty
3
3
 
4
4
  # Load a file that contains a pool into memory
5
5
  def load_pool(filename=nil)
6
- filename = Dir["#{Dir.pwd}/**/*.rb"].select {|f| ::File.basename(f) == "clouds.rb" }.first unless filename
6
+ filename = Binary.get_existing_spec_location#Dir["#{Dir.pwd}/**/*.rb"].select {|f| ::File.basename(f) == "clouds.rb" }.first unless filename
7
+ dputs "Using spec at #{filename}"
7
8
 
8
9
  unless filename && ::File.readable?(filename)
9
10
  puts "Please specify your cloud with -s, move it to ./clouds.rb or in your POOL_SPEC environment variable"
@@ -83,7 +83,7 @@ module PoolParty
83
83
  @opts.separator "Options:"
84
84
 
85
85
  @opts.on('-v', '--verbose', 'Be verbose') { self.verbose true }
86
- @opts.on('', "--debug", "Debug setting") {self.debug true}
86
+ @opts.on('', "--debug", "Debug setting") {self.debugging true}
87
87
  @opts.on('-s [file]', '--spec-file [file]', 'Set the spec file') { |file| self.spec file.chomp }
88
88
  @opts.on('-t', '--test', 'Testing mode') { self.testing true }
89
89
 
@@ -1,3 +1,11 @@
1
+ =begin rdoc
2
+ CloudResourcer provides the cloud with convenience methods
3
+ that you can call on your cloud. This is where the
4
+
5
+ instances 2..10
6
+
7
+ method is stored, for instance. It's also where the key convenience methods are written
8
+ =end
1
9
  require "ftools"
2
10
 
3
11
  module PoolParty
@@ -50,6 +58,25 @@ module PoolParty
50
58
  # end
51
59
  end
52
60
 
61
+ # Keypairs
62
+ def keypair(*args)
63
+ if args && !args.empty? && !has_keypair?
64
+ options[:keypair] = args.first
65
+ else
66
+ options[:keypair] ||= generate_keypair
67
+ end
68
+ end
69
+
70
+ # Let's just make sure that the keypair exists on the options
71
+ def has_keypair?
72
+ options.has_key?(:keypair) && options[:keypair] && !options[:keypair].empty?
73
+ end
74
+ # Generate a keypair based on the parent's name (if there is a parent)
75
+ # and the cloud's name
76
+ def generate_keypair(*args)
77
+ options[:keypair] = "#{parent && parent.is_a?(PoolParty::Pool::Pool) ? parent.name : "poolparty"}_#{name}" unless has_keypair?
78
+ end
79
+
53
80
  def full_keypair_path
54
81
  unless keypair_path
55
82
  raise RuntimeException.new("Keypair cannot be found")
@@ -102,8 +129,8 @@ module PoolParty
102
129
  def keypair_paths
103
130
  [
104
131
  Base.base_keypair_path,
105
- Base.remote_storage_path,
106
- Base.base_config_directory
132
+ Base.base_config_directory,
133
+ Base.remote_storage_path
107
134
  ]
108
135
  end
109
136
 
@@ -41,6 +41,12 @@ module PoolParty
41
41
  def cancelled?
42
42
  options[:cancelled] || false
43
43
  end
44
+ def printed(*args)
45
+ options[:printed] = true
46
+ end
47
+ def printed?
48
+ options[:printed] || false
49
+ end
44
50
  # Give us a template to work with on the resource
45
51
  # Make sure this template is moved to the tmp directory as well
46
52
  #
@@ -105,15 +105,19 @@ end
105
105
  when_all_assigned_ips {wait "5.seconds"}
106
106
  end
107
107
 
108
+ # Attach a volume to the instance
108
109
  def attach_volume(instance=nil)
109
110
  vputs "Attaching volume #{ebs_volume_id} to the master at #{ebs_volume_device}"
110
111
  instance = master
111
112
  ec2.attach_volume(:volume_id => ebs_volume_id, :instance_id => instance.instance_id, :device => ebs_volume_device) if ebs_volume_id && ebs_volume_mount_point
112
113
  end
114
+ # Associate an address with the instance using ec2
113
115
  def associate_address(instance=nil)
114
- vputs "Associating master with #{set_master_ip_to}"
115
- instance = master
116
- ec2.associate_address(:instance_id => instance.instance_id, :public_ip => set_master_ip_to) if set_master_ip_to
116
+ if set_master_ip_to
117
+ dputs "Associating master with #{set_master_ip_to}"
118
+ instance = master
119
+ ec2.associate_address(:instance_id => instance.instance_id, :public_ip => set_master_ip_to) if set_master_ip_to
120
+ end
117
121
  end
118
122
 
119
123
  # Help create a keypair for the cloud
@@ -140,12 +144,9 @@ end
140
144
  )
141
145
  end
142
146
 
147
+ # These are tasks that run before the configuration runs
143
148
  def before_configuration_tasks
144
- if has_cert_and_key?
145
- # copy_file_to_storage_directory(pub_key)
146
- # copy_file_to_storage_directory(private_key)
147
- end
148
- if set_master_ip_to && master.ip.to_s != set_master_ip_to.to_s
149
+ if set_master_ip_to && master.ip && master.ip.to_s != set_master_ip_to.to_s
149
150
  associate_address(master)
150
151
  reset_remoter_base!
151
152
 
@@ -144,9 +144,9 @@ module PoolParty
144
144
  # A convenience method for waiting until there are no more
145
145
  # pending instances and then running the block
146
146
  def when_no_pending_instances(&block)
147
- reset!
148
- if list_of_pending_instances.size == 0
149
- vputs ""
147
+ reset!
148
+ if list_of_pending_instances && list_of_pending_instances.size == 0
149
+ vputs "" # Clear the terminal with a newline
150
150
  block.call if block
151
151
  else
152
152
  vprint "."
@@ -236,14 +236,14 @@ module PoolParty
236
236
  !list_of_running_instances.select {|a| a.name == "master"}.first.nil?
237
237
  end
238
238
  # Stub method for the time being to handle expansion of the cloud
239
- def should_expand_cloud?(force=false)
239
+ def can_expand_cloud?(force=false)
240
240
  (are_too_few_instances_running? || are_expansion_rules_valid? ) || force || false
241
241
  end
242
242
  def are_expansion_rules_valid?
243
243
  valid_rules?(:expand_when)
244
244
  end
245
245
  # Stub method for the time being to handle the contraction of the cloud
246
- def should_contract_cloud?(force=false)
246
+ def can_contract_cloud?(force=false)
247
247
  return true if force
248
248
  ((are_any_nodes_exceeding_minimum_runtime? and are_too_many_instances_running?) || are_contraction_rules_valid?) || false
249
249
  end
@@ -257,7 +257,7 @@ module PoolParty
257
257
  # online, then provision it as a slave, this way, it is ready for action from the
258
258
  # get go
259
259
  def expand_cloud_if_necessary(force=false)
260
- if can_start_a_new_instance? && should_expand_cloud?(force)
260
+ if can_start_a_new_instance? && can_expand_cloud?(force)
261
261
  vputs "Expanding the cloud based on load"
262
262
  @num = 1
263
263
  @num.times do |i|
@@ -273,7 +273,7 @@ module PoolParty
273
273
  # If we can shutdown an instnace and the load allows us to contract
274
274
  # the cloud, then we should request_termination_of_non_master_instance
275
275
  def contract_cloud_if_necessary(force=false)
276
- if can_shutdown_an_instance? && should_contract_cloud?(force)
276
+ if can_shutdown_an_instance? && can_contract_cloud?(force)
277
277
  vputs "Shrinking the cloud by 1"
278
278
  before_shutdown
279
279
  request_termination_of_non_master_instance
@@ -1,14 +1,20 @@
1
1
  module PoolParty
2
2
  class GitResource
3
-
3
+
4
4
  virtual_resource(:git) do
5
+ def loaded(*args)
6
+ has_package(:name => "git-core")
7
+ end
8
+ end
9
+
10
+ virtual_resource(:git_repos) do
5
11
 
6
- def loaded(opts={}, parent=self)
12
+ def loaded(opts={}, parent=self, &block)
13
+ has_git
7
14
  has_git_repos
8
15
  end
9
16
 
10
- def has_git_repos
11
- has_package(:name => "git-core")
17
+ def has_git_repos
12
18
  has_exec({:name => key, :requires => [get_directory("#{working_dir}"), get_package("git-core")] }) do
13
19
  command requires_user ? "git clone #{requires_user}@#{source} #{working_dir}" : "cd #{working_dir} && git clone #{source}"
14
20
  cwd "#{working_dir if working_dir}"
@@ -4,8 +4,11 @@ module PoolParty
4
4
  virtual_resource(:rsyncmirror) do
5
5
 
6
6
  def loaded(opts={}, parent=self)
7
- @parent = parent
8
- has_exec(opts.merge({:command => "#{cloud.remote_rsync_command} --no-implied-dirs --delete-excluded #{Base.user}@master:#{dir}/ #{dir}/".safe_quote, :name => "rsync-#{name}"}))
7
+ @parent = parent
8
+ execute_on_node do
9
+ @dir = dir || name
10
+ has_exec(opts.merge({:command => "#{cloud.remote_rsync_command} --no-implied-dirs --delete-excluded #{Base.user}@master:#{@dir}/ #{@dir}/".safe_quote, :name => "rsync-#{name}"}))
11
+ end
9
12
  end
10
13
 
11
14
  # Since git is not a native type, we have to say which core resource
@@ -71,17 +71,6 @@ module PoolParty
71
71
  def name
72
72
  @cloud_name
73
73
  end
74
-
75
- # Keypairs
76
- # Let's just make sure that the keypair exists on the options
77
- def has_keypair?
78
- options.has_key?(:keypair) && options[:keypair] && !options[:keypair].empty?
79
- end
80
- # Generate a keypair based on the parent's name (if there is a parent)
81
- # and the cloud's name
82
- def generate_keypair(*args)
83
- options[:keypair] = "#{parent && parent.is_a?(PoolParty::Pool::Pool) ? parent.name : "poolparty"}_#{name}" unless has_keypair?
84
- end
85
74
 
86
75
  # Prepare to send the new configuration to the instances
87
76
  # First, let's make sure that our base directory is made
@@ -17,17 +17,23 @@ module PoolParty
17
17
  resources[type] ||= []
18
18
  end
19
19
 
20
+ # Add resource
21
+ # When we are looking to add a resource, we want to make sure the
22
+ # resources isn't already added. This way we prevent duplicates
23
+ # as puppet can be finicky about duplicate resource definitions.
24
+ # We'll look for the resource in either a local or global store
25
+ # If the resource appears in either, return that resource, we'll just append
26
+ # to the resource config, otherwise instantiate a new resource of the type
27
+ # and store it into the global and local resource stores
28
+ #
29
+ # A word about stores, the global store stores the entire list of stored
30
+ # resources. The local resource store is available on all clouds and plugins
31
+ # which stores the instance variable's local resources.
20
32
  def add_resource(type, opts={}, parent=self, &block)
21
- if opts[:name] && in_a_resource_store?(type, opts[:name])
22
- @res = get_from_local_resource_store(type, opts[:name], parent)
23
- @res ||= get_from_global_resource_store(type, opts[:name])
24
- # if should_duplicate_resource?(type, @res, parent, opts)
25
- # unless @res.parent == parent
26
- # @pa = parent
27
- # @res.instance_eval {@parent = @pa}
28
- # end
29
- # parent.resource(type) << @res
30
- # end
33
+ temp_name = (opts[:name] || "#{type}_#{type.to_s.keyerize}")
34
+ if in_a_resource_store?(type, temp_name)
35
+ @res = get_from_local_resource_store(type, temp_name, parent)
36
+ @res ||= get_from_global_resource_store(type, temp_name)
31
37
  else
32
38
  @res = returning "PoolParty::Resources::#{type.to_s.camelize}".camelize.constantize.new(opts, parent, &block) do |o|
33
39
  store_into_global_resource_store(o)
@@ -89,10 +95,22 @@ module PoolParty
89
95
  # For the time being, we'll make puppet the only available dependency resolution
90
96
  # base, but in the future, we can rip this out and make it an option
91
97
  include PoolParty::DependencyResolutions::Puppet
98
+ # DSL Overriders
99
+ include PoolParty::ResourcingDsl
92
100
 
93
101
  extend PoolParty::Resources
94
102
  include PoolParty::Resources
95
103
 
104
+ # When we subclass Resource, we want to add a few methods to the Resources class
105
+ # This will anable us to call out to these resources in our DSLified manner
106
+ # When we call a method from the subclass, say it's the File class
107
+ # then we want to be able to have the method file() available.
108
+ # We also want to be able to fetch the resource with a get_file method.
109
+ # This will just call out to get the resource. If the resource isn't available
110
+ # in a resource store, we expect to return a nil result.
111
+ # Finally, the has_ and does_not_have_ methods are appended. See below for
112
+ # those methods. Then we make sure we add these resources as available_resources
113
+ # onto the class so we know it's available as a resource
96
114
  def self.inherited(subclass)
97
115
  subclass = subclass.to_s.split("::")[-1] if subclass.to_s.index("::")
98
116
  lowercase_class_name = subclass.to_s.underscore.downcase || subclass.downcase
@@ -104,13 +122,8 @@ module PoolParty
104
122
  add_resource(:#{lowercase_class_name}, opts, parent, &blk)
105
123
  end
106
124
  def get_#{lowercase_class_name}(n, opts={}, parent=self, &block)
107
- res = in_a_resource_store?(:#{lowercase_class_name}, n) ?
108
- get_resource(:#{lowercase_class_name}, n) :
109
- nil
110
- # PoolParty::Resources::Resource.resource_string_name(#{lowercase_class_name}, n)
111
- # add_resource(:#{lowercase_class_name}, opts, parent, &blk)
112
- # res ||= PoolParty::Resources::Resource.resource_string_name(#{lowercase_class_name}, n)
113
- res
125
+ in_a_resource_store?(:#{lowercase_class_name}, n) ?
126
+ get_resource(:#{lowercase_class_name}, n) : nil
114
127
  end
115
128
  EOE
116
129
  PoolParty::Resources.module_eval method
@@ -120,14 +133,12 @@ module PoolParty
120
133
  end
121
134
  end
122
135
 
136
+ # Keep track of the resources that are available. This way we can show some pretty output
137
+ # later and ensure that we are only calling available resources
123
138
  def self.available_resources
124
139
  @available_resources ||= []
125
140
  end
126
141
 
127
- def self.available_resource_methods
128
- available_resources.map {|a| a.my_methods }
129
- end
130
-
131
142
  # This is set in order of descending precedence
132
143
  # The options are overwritten from the bottom up
133
144
  # and the resource will use those as the values
@@ -141,7 +152,7 @@ module PoolParty
141
152
 
142
153
  set_resource_parent
143
154
 
144
- loaded(opts, @parent)
155
+ loaded(opts, @parent, &block)
145
156
  end
146
157
 
147
158
  # Helper to set the containing parent on the resource
@@ -184,9 +195,6 @@ module PoolParty
184
195
  end
185
196
  end
186
197
 
187
- # DSL Overriders
188
- include PoolParty::ResourcingDsl
189
-
190
198
  def same_resources_of(t, k)
191
199
  key == k && class_name_sym == t
192
200
  end
@@ -20,9 +20,21 @@ module PoolParty
20
20
  end
21
21
  end
22
22
 
23
- # Wrap all the resources into a class package from
23
+ # Wrap all the resources into a class package.
24
+ # This method will first check to see if a class has already been declared
25
+ # and run the containing block on it to attach the new resources on to the new block
26
+ # If the class does not exist, then it is the responsibility of this method to pull
27
+ # the resources from the parent into the new class package resource and remove them
28
+ # from the parent. This way we can conveniently write classes into the manifest,
29
+ # giving us separation for variables and the like.
30
+ # Finally, the method will remove the all resources from the contianing parent and add
31
+ # the class package as the resource.
32
+ # Note that it only removes resources that are not class packages, so this method will
33
+ # not remove other classes that have been attached to the same resource.
34
+ # TODO CLEAN THIS UP
24
35
  def classpackage_with_self(parent=self, &block)
25
36
  name = (parent && parent.options.name || Classpackage.name(parent).to_s).sanitize
37
+
26
38
  if in_global_classpackages?(name)
27
39
  returning get_from_global_classpackage_store(name) do |cls|
28
40
  cls.run_in_context(parent, &block) if block
@@ -55,13 +67,8 @@ module PoolParty
55
67
  })
56
68
 
57
69
  def initialize(opts={}, parent=self, &block)
58
- # Take the options of the parents
59
- # set_parent(parent, false) if parent
60
70
  set_vars_from_options(opts) unless opts.empty?
61
- # self.instance_eval &block if block
62
71
  run_setup(parent, &block) if block
63
- # self.run_in_context &block if block
64
- # store_block(&block)
65
72
  loaded
66
73
  end
67
74
 
@@ -11,8 +11,10 @@ module PoolParty
11
11
  [:name, :source]
12
12
  end
13
13
 
14
+ # We can set the source several ways, with either source or from
15
+ # in the manifest
14
16
  def present
15
- source
17
+ source || from
16
18
  end
17
19
 
18
20
  def printable?
@@ -1,5 +1,5 @@
1
1
  ["core", "spec"].each do |dir|
2
- Dir[File.join(File.dirname(__FILE__), "poolparty", "spec", dir, "*.rb")].each {|f| require f}
2
+ Dir[File.join(File.dirname(__FILE__), "spec", dir, "*.rb")].each {|f| require f}
3
3
  end
4
4
 
5
5
  class TestCloudClass < PoolParty::Cloud::Cloud
@@ -2,7 +2,7 @@ module PoolParty
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- TINY = 90
5
+ TINY = 91
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.90
4
+ version: 0.2.91
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-18 00:00:00 -08:00
12
+ date: 2008-12-21 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -392,6 +392,7 @@ files:
392
392
  - lib/poolparty/provisioners/capistrano/recipies/master.rb
393
393
  - lib/poolparty/provisioners/capistrano/recipies/slave.rb
394
394
  - lib/poolparty/provisioners/provisioner_base.rb
395
+ - lib/poolparty/spec.rb
395
396
  - lib/poolparty/spec/core/string.rb
396
397
  - lib/poolparty/spec/matchers/a_spec_extensions_base.rb
397
398
  - lib/poolparty/spec/matchers/have_cron.rb
@@ -435,7 +436,6 @@ files:
435
436
  - lib/poolparty/templates/yaws.conf
436
437
  - lib/poolparty/version.rb
437
438
  - lib/poolpartycl.rb
438
- - lib/poolpartyspec.rb
439
439
  - log/pool.log
440
440
  - poolparty.gemspec
441
441
  - script/destroy
@@ -535,7 +535,7 @@ files:
535
535
  has_rdoc: true
536
536
  homepage: http://poolparty.rubyforge.org
537
537
  post_install_message: |-
538
- Get ready to jump in the pool, you just installed PoolParty! (Updated at 13:28 12/18/08)
538
+ Get ready to jump in the pool, you just installed PoolParty! (Updated at 00:13 12/21/08)
539
539
 
540
540
  To get started, run the generator:
541
541
 
@@ -9,7 +9,7 @@ describe "Console" do
9
9
  ::File.stub!(:readable?).and_return true
10
10
  Dir.stub!(:pwd).and_return "/flop"
11
11
  Dir.stub!(:[]).and_return []
12
- Dir.stub!(:[]).with("/flop/**/*.rb").and_return ["clouds.rb"]
12
+ Dir.stub!(:[]).with("/flop/*/*.rb").and_return ["clouds.rb"]
13
13
  end
14
14
  describe "load_pool" do
15
15
  before(:each) do
@@ -69,6 +69,7 @@ describe "Console" do
69
69
  ::File.stub!(:readable?).with(@filename).and_return true
70
70
  @filename.stub!(:read).and_return "spec contents"
71
71
  self.stub!(:open).with(@filename).and_return @filename
72
+ Binary.stub!(:get_existing_spec_location).and_return @filename
72
73
  end
73
74
  it "should call readable on the string sent in to load_pool" do
74
75
  lambda {
@@ -32,7 +32,7 @@ describe "Binary" do
32
32
  Dir.stub!(:pwd).and_return "/flop"
33
33
  end
34
34
  it "should call Dir[Dir.pwd] if there is no filename given" do
35
- Dir.should_receive(:[]).with("#{Dir.pwd}/**/*.rb").and_return ["clouds.rb"]
35
+ Dir.should_receive(:[]).with("#{Dir.pwd}/*/clouds.rb").and_return ["clouds.rb"]
36
36
  Binary.load_pool
37
37
  end
38
38
  end
@@ -229,14 +229,14 @@ describe "Remote" do
229
229
  @tc.should_receive(:can_start_a_new_instance?).once
230
230
  end
231
231
  it "should see if we should expand the cloud" do
232
- @tc.should_receive(:should_expand_cloud?).once.and_return false
232
+ @tc.should_receive(:can_expand_cloud?).once.and_return false
233
233
  end
234
- it "should call request_launch_new_instances if we should_expand_cloud?" do
235
- @tc.should_receive(:should_expand_cloud?).once.and_return true
234
+ it "should call request_launch_new_instances if we can_expand_cloud?" do
235
+ @tc.should_receive(:can_expand_cloud?).once.and_return true
236
236
  @tc.should_receive(:request_launch_one_instance_at_a_time).once.and_return [{:ip => "127.0.0.5", :name => "node2"}]
237
237
  end
238
238
  it "should call a new slave provisioner" do
239
- @tc.stub!(:should_expand_cloud?).once.and_return true
239
+ @tc.stub!(:can_expand_cloud?).once.and_return true
240
240
  @provisioner.should_receive(:install).at_least(1)
241
241
  end
242
242
  after(:each) do
@@ -255,10 +255,10 @@ describe "Remote" do
255
255
  @tc.should_receive(:can_shutdown_an_instance?).once
256
256
  end
257
257
  it "should see if we should contract the cloud" do
258
- @tc.should_receive(:should_contract_cloud?).once.and_return false
258
+ @tc.should_receive(:can_contract_cloud?).once.and_return false
259
259
  end
260
- it "should call request_termination_of_non_master_instance if we should_contract_cloud?" do
261
- @tc.stub!(:should_contract_cloud?).and_return true
260
+ it "should call request_termination_of_non_master_instance if we can_contract_cloud?" do
261
+ @tc.stub!(:can_contract_cloud?).and_return true
262
262
  @tc.should_receive(:request_termination_of_non_master_instance).once.and_return true
263
263
  end
264
264
  after(:each) do
@@ -18,18 +18,18 @@ describe "Remote Instance" do
18
18
  @tc = TestGitClass.new
19
19
  end
20
20
  it "should be a string" do
21
- @tc.has_git(:at => "/var/www/", :name => "gitrepos.git", :source => "git://source.git").to_string.should =~ /exec/
21
+ @tc.has_git_repos(: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", :requires_user => "finger", :at => "/var/www/"}).to_string.should =~ /finger@git:/
24
+ @tc.has_git_repos({: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
- @tc.has_git({:name => "git.git", :source => "git://source.git",:at => "/var/www/"}).to_string.should =~ /git clone git:/
27
+ @tc.has_git_repos({:name => "git.git", :source => "git://source.git",:at => "/var/www/"}).to_string.should =~ /git clone git:/
28
28
  end
29
29
  describe "in resource" do
30
30
  before(:each) do
31
31
  @tc.instance_eval do
32
- has_git(:name => "gittr") do
32
+ has_git_repos(:name => "gittr") do
33
33
  source "git://source.git"
34
34
  path "/var/www/xnot.org"
35
35
  symlink "/var/www/xnot.org/public"
@@ -38,7 +38,7 @@ describe "Remote Instance" do
38
38
  end
39
39
  end
40
40
  it "should have the path set within the resource" do
41
- @tc.resource(:git).first.to_string.should =~ /exec \{ \"git-gittr/
41
+ @tc.resource(:git_repos).first.to_string.should =~ /exec \{ \"git-gittr/
42
42
  end
43
43
  end
44
44
  end
@@ -15,8 +15,9 @@ describe "User" do
15
15
  name "bob"
16
16
  home "/home/bob"
17
17
  end
18
- @user.to_string.should =~ /"bob":/
19
- @user.to_string.should =~ /home => '\/home\/bob'/
18
+ @string = @user.to_string
19
+ @string.should =~ /"bob":/
20
+ @string.should =~ /home => '\/home\/bob'/
20
21
  end
21
22
  describe "as included" do
22
23
  before(:each) do
@@ -26,6 +26,9 @@ describe "PoolParty" do
26
26
  PoolParty.write_to_file_in_storage_directory("/usr/bin/happydayz", "write this text")
27
27
  File.open(@path).read.should == "write this text"
28
28
  end
29
+ after(:each) do
30
+ ::FileUtils.rm @path rescue ""
31
+ end
29
32
  end
30
33
  it "should have a logger" do
31
34
  PoolParty.log.should_not be_nil
@@ -16,6 +16,9 @@ ENV["POOL_SPEC"] = nil
16
16
  include PoolParty
17
17
  extend PoolParty
18
18
 
19
+ def debugging
20
+ false
21
+ end
19
22
  def are_too_many_instances_running?
20
23
  end
21
24
  def are_any_nodes_exceeding_minimum_runtime?
@@ -119,6 +122,8 @@ def stub_remoting_methods_for(o)
119
122
  o.stub!(:before_install).and_return true
120
123
  o.stub!(:process_install).and_return true
121
124
  o.stub!(:after_install).and_return true
125
+ o.stub!(:can_contract_cloud?).and_return false
126
+ o.stub!(:can_expand_cloud?).and_return false
122
127
  end
123
128
  def stub_list_of_instances_for(o)
124
129
  # o.stub!(:list_of_running_instances).once.and_return running_remote_instances
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.90</a>
37
+ <a href="http://rubyforge.org/projects/poolparty" class="numbers">0.2.91</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.90
4
+ version: 0.2.91
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-18 00:00:00 -08:00
12
+ date: 2008-12-21 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -392,6 +392,7 @@ files:
392
392
  - lib/poolparty/provisioners/capistrano/recipies/master.rb
393
393
  - lib/poolparty/provisioners/capistrano/recipies/slave.rb
394
394
  - lib/poolparty/provisioners/provisioner_base.rb
395
+ - lib/poolparty/spec.rb
395
396
  - lib/poolparty/spec/core/string.rb
396
397
  - lib/poolparty/spec/matchers/a_spec_extensions_base.rb
397
398
  - lib/poolparty/spec/matchers/have_cron.rb
@@ -435,7 +436,6 @@ files:
435
436
  - lib/poolparty/templates/yaws.conf
436
437
  - lib/poolparty/version.rb
437
438
  - lib/poolpartycl.rb
438
- - lib/poolpartyspec.rb
439
439
  - log/pool.log
440
440
  - poolparty.gemspec
441
441
  - script/destroy
@@ -535,7 +535,7 @@ files:
535
535
  has_rdoc: true
536
536
  homepage: http://poolparty.rubyforge.org
537
537
  post_install_message: |-
538
- Get ready to jump in the pool, you just installed PoolParty! (Updated at 13:28 12/18/08)
538
+ Get ready to jump in the pool, you just installed PoolParty! (Updated at 00:13 12/21/08)
539
539
 
540
540
  To get started, run the generator:
541
541