ironfan 4.0.1 → 4.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ # v4.0.2: Parallel calls working once more
2
+ * Added Ironfan.parallelize, to run the basic cluster commands in parallel against their servers
3
+ * Make security_group range and group authorizations store only unique values
4
+
5
+ # v4.0.1: Minor bug-fixes
6
+ * Don't attempt to correlate the node volumes hash unless it's set
7
+ * RaidGroup declared by the DSL should get a name (so it can be indexed correctly)
8
+ * Volume.defaults is deprecated
9
+
1
10
  # v4.0.0: Major refactoring to allow multicloud support
2
11
  * First pass at a provider plugin API, with EC2 as the working example.
3
12
  * Removed role_implications: these can be handled by explicit ec2.security_group calls for now. See https://github.com/infochimps-labs/ironfan/wiki/Upgrading-to-v4 for more details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.0.1
1
+ 4.0.2
data/ironfan.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "ironfan"
8
- s.version = "4.0.1"
8
+ s.version = "4.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Infochimps"]
12
- s.date = "2012-09-06"
12
+ s.date = "2012-09-07"
13
13
  s.description = "Ironfan allows you to orchestrate not just systems but clusters of machines. It includes a powerful layer on top of knife and a collection of cloud cookbooks."
14
14
  s.email = "coders@infochimps.com"
15
15
  s.extra_rdoc_files = [
@@ -237,7 +237,7 @@ module Ironfan
237
237
  # Discovery
238
238
  #
239
239
  def correlate
240
- values.each {|computer| computer.correlate }
240
+ Ironfan.delegate_to(values) { correlate }
241
241
  end
242
242
 
243
243
  def validate
@@ -252,21 +252,25 @@ module Ironfan
252
252
  # Manipulation
253
253
  #
254
254
  def kill(options={})
255
- Ironfan.delegate_to(values) { kill(options) }
255
+ Ironfan.parallelize(values) { kill(options) }
256
256
  end
257
257
  def launch
258
- Ironfan.delegate_to(values) { launch }
258
+ Ironfan.parallelize(values) { launch }
259
259
  end
260
260
  def save(options={})
261
- Ironfan.delegate_to(values) { save(options) }
261
+ Ironfan.parallelize(values) { save(options) }
262
262
  end
263
263
  def start
264
- Ironfan.delegate_to(values) { start }
264
+ Ironfan.parallelize(values) { start }
265
265
  end
266
266
  def stop
267
- Ironfan.delegate_to(values) { stop }
267
+ Ironfan.parallelize(values) { stop }
268
268
  end
269
269
 
270
+ #
271
+ # Utility
272
+ #
273
+
270
274
  # set up new computers for each server in the cluster definition
271
275
  def create_expected!
272
276
  self.cluster.servers.each do |server|
@@ -306,7 +310,7 @@ module Ironfan
306
310
  eval("[#{slice_indexes}]").map {|idx| idx.class == Range ? idx.to_a : idx}.flatten
307
311
  end
308
312
 
309
- # Utility function to provide a human-readable list of names
313
+ # provide a human-readable list of names
310
314
  def joined_names
311
315
  values.map(&:name).join(", ").gsub(/, ([^,]*)$/, ' and \1')
312
316
  end
@@ -103,11 +103,13 @@ module Ironfan
103
103
  range = (range .. range) if range.is_a?(Integer)
104
104
  range_authorizations << [range, cidr_ip, ip_protocol]
105
105
  range_authorizations.compact!
106
+ range_authorizations.uniq!
106
107
  end
107
108
 
108
109
  def authorized_by_group(other_name)
109
110
  group_authorized_by << other_name.to_s
110
111
  group_authorized_by.compact!
112
+ group_authorized_by.uniq!
111
113
  end
112
114
  end
113
115
 
@@ -37,7 +37,7 @@ module Ironfan
37
37
  return unless Ec2.applicable computer
38
38
 
39
39
  ensure_groups(computer)
40
- groups = computer.server.cloud(:ec2).security_groups.keys.map{|k| k.to_s}.uniq
40
+ groups = self.expected_ids(computer)
41
41
  # Only handle groups that don't already exist
42
42
  groups.delete_if {|group| recall? group.to_s }
43
43
  return if groups.empty?
data/lib/ironfan.rb CHANGED
@@ -24,11 +24,21 @@ module Ironfan
24
24
  def self.chef_config=(cc) @chef_config = cc ; end
25
25
  def self.chef_config() @chef_config ; end
26
26
 
27
- # simple delegation to multiple targets
27
+ # simple delegation to multiple targets
28
28
  def self.delegate_to(targets,options={},&block)
29
29
  raise 'missing block' unless block_given?
30
30
  [targets].flatten.each {|target| target.instance_eval &block }
31
31
  end
32
+
33
+ # delegate to multiple targets in parallel
34
+ def self.parallelize(targets,options={},&block)
35
+ raise 'missing block' unless block_given?
36
+ [targets].flatten.map do |t|
37
+ sleep(0.1) # avoid hammering with simultaneous requests
38
+ Thread.new(t) {|t| t.instance_eval &block }
39
+ end.each(&:join)
40
+ end
41
+
32
42
  #
33
43
  # Defines a cluster with the given name.
34
44
  #
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ironfan
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 4.0.1
5
+ version: 4.0.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Infochimps
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-09-06 00:00:00 Z
13
+ date: 2012-09-07 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: chef
@@ -232,7 +232,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
232
232
  requirements:
233
233
  - - ">="
234
234
  - !ruby/object:Gem::Version
235
- hash: 4333308568630839525
235
+ hash: 318287528418950841
236
236
  segments:
237
237
  - 0
238
238
  version: "0"