ironfan 4.0.5 → 4.0.8

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.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # v4.0.8:
2
+ * Removed .delegates_to, .parallelize in favor of manual delegation (via .each) and .parallel, to remove assumption that calls must be in the context of the individual object (preparation for fixing bootstrapping)
3
+ * Adding cluster and facet roles to server run list (fixes #160)
4
+ * Fixed blocking bugs in launch (bad versions 4.0.6 & 4.0.7)
5
+
1
6
  # v4.0.5: security_group bug-fixes
2
7
  * Fix for snapshot_id setting in cluster DSL
3
8
  * Reinstated missing group_authorized capability
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.0.5
1
+ 4.0.8
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.5"
8
+ s.version = "4.0.8"
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-18"
12
+ s.date = "2012-09-20"
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 = [
@@ -51,7 +51,7 @@ module Ironfan
51
51
 
52
52
  def validate
53
53
  computer = self
54
- Ironfan.delegate_to(chosen_resources) { validate_computer! computer }
54
+ chosen_resources.each {|r| r.validate_computer! computer }
55
55
  end
56
56
 
57
57
  #
@@ -131,8 +131,8 @@ module Ironfan
131
131
  values["Chef?"] = "no"
132
132
  values["State"] = "not running"
133
133
 
134
- delegate_to([ server, node, machine ].compact) do
135
- to_display style, values
134
+ [ server, node, machine ].compact.each do |part|
135
+ part.to_display style, values
136
136
  end
137
137
 
138
138
  if style == :expanded
@@ -228,34 +228,34 @@ module Ironfan
228
228
  # Discovery
229
229
  #
230
230
  def correlate
231
- Ironfan.delegate_to(values) { correlate }
231
+ values.each {|c| c.correlate }
232
232
  end
233
233
 
234
234
  def validate
235
235
  providers = values.map {|c| c.providers.values}.flatten
236
236
  computers = self
237
237
 
238
- Ironfan.delegate_to(values) { validate }
239
- Ironfan.delegate_to(providers) { validate computers }
238
+ values.each {|c| c.validate }
239
+ providers.each {|p| p.validate computers }
240
240
  end
241
241
 
242
242
  #
243
243
  # Manipulation
244
244
  #
245
245
  def kill(options={})
246
- Ironfan.parallelize(values) { kill(options) }
246
+ Ironfan.parallel(values) {|c| c.kill(options) }
247
247
  end
248
248
  def launch
249
- Ironfan.parallelize(values) { launch }
249
+ Ironfan.parallel(values) {|c| c. launch }
250
250
  end
251
251
  def save(options={})
252
- Ironfan.parallelize(values) { save(options) }
252
+ Ironfan.parallel(values) {|c| c. save(options) }
253
253
  end
254
254
  def start
255
- Ironfan.parallelize(values) { start }
255
+ Ironfan.parallel(values) {|c| c. start }
256
256
  end
257
257
  def stop
258
- Ironfan.parallelize(values) { stop }
258
+ Ironfan.parallel(values) {|c| c. stop }
259
259
  end
260
260
 
261
261
  #
@@ -16,7 +16,7 @@ module Ironfan
16
16
  computers = Computers.new(:cluster => cluster.resolve)
17
17
  providers = computers.map{|c| c.providers.values}.flatten.uniq
18
18
 
19
- delegate_to(providers) { load cluster }
19
+ providers.each {|p| p.load cluster }
20
20
  computers.correlate
21
21
  computers.validate
22
22
  computers
@@ -5,10 +5,6 @@ module Ironfan
5
5
 
6
6
  def self.ui() Ironfan.ui ; end
7
7
  def ui() Ironfan.ui ; end
8
-
9
- def delegate_to(*args,&block)
10
- Ironfan.delegate_to(*args,&block)
11
- end
12
8
  end
13
9
 
14
10
  end
@@ -9,6 +9,9 @@ module Ironfan
9
9
  unless attrs[:owner].nil?
10
10
  self.cluster_name = attrs[:owner].cluster_name
11
11
  self.facet_name = attrs[:owner].name
12
+
13
+ self.role "#{self.cluster_name}_cluster", :last
14
+ self.role attrs[:owner].facet_role.name, :last
12
15
  end
13
16
  super
14
17
  end
@@ -24,11 +24,11 @@ module Ironfan
24
24
  # Discovery
25
25
  #
26
26
  def self.load(cluster)
27
- Ironfan.delegate_to(resources) { load! cluster }
27
+ resources.each {|r| r.load! cluster }
28
28
  end
29
29
 
30
30
  def self.validate(computers)
31
- Ironfan.delegate_to(resources) { validate_resources! computers }
31
+ resources.each {|r| r.validate_resources! computers }
32
32
  end
33
33
 
34
34
 
@@ -119,13 +119,13 @@ module Ironfan
119
119
  # Create all things that aren't machines
120
120
  targets = resources.reject {|type| type < IaasProvider::Machine}
121
121
  computers.each do |computer|
122
- delegate_to(targets) { create! computer }
122
+ targets.each {|r| r.create! computer }
123
123
  end
124
124
  end
125
125
 
126
126
  def save!(computers)
127
127
  computers.each do |computer|
128
- delegate_to(resources) { save! computer }
128
+ targets.each {|r| r.save! computer }
129
129
  end
130
130
  end
131
131
 
data/lib/ironfan.rb CHANGED
@@ -24,19 +24,13 @@ 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
28
- def self.delegate_to(targets,options={},&block)
27
+ # execute against multiple targets in parallel
28
+ def self.parallel(targets,options={})
29
29
  raise 'missing block' unless block_given?
30
- [targets].flatten.each {|target| target.instance_eval &block }
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|
30
+ [targets].flatten.map do |target|
37
31
  sleep(0.1) # avoid hammering with simultaneous requests
38
- Thread.new(t) {|t| t.instance_eval &block }
39
- end.each(&:join)
32
+ Thread.new(target) {|target| yield target }
33
+ end.each(&:join) # wait for all the blocks to return
40
34
  end
41
35
 
42
36
  #
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ironfan
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 4.0.5
5
+ version: 4.0.8
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-18 00:00:00 Z
13
+ date: 2012-09-20 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: 3351900580010290705
235
+ hash: -2934265328136200700
236
236
  segments:
237
237
  - 0
238
238
  version: "0"