ironfan 6.1.0 → 6.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -100,16 +100,27 @@ class Chef
100
100
  section("Launching computers", :green)
101
101
  display(target)
102
102
  launched = target.launch
103
- # As each server finishes, configure it
103
+
104
+ # As each server finishes, configure it. If we received an
105
+ # exception launching any of the machines, remember it.
106
+
107
+ launch_succeeded = true
104
108
  Ironfan.parallel(launched) do |computer|
105
- if (computer.is_a?(Exception)) then ui.warn "Error launching #{computer.inspect}; skipping after-launch tasks."; next; end
106
- perform_after_launch_tasks(computer) if computer.machine.perform_after_launch_tasks?
109
+ if (computer.is_a?(Exception)) then
110
+ ui.error "Error launching #{computer.inspect}; skipping after-launch tasks.";
111
+ launch_succeeded = false
112
+ else
113
+ perform_after_launch_tasks(computer) if computer.machine.perform_after_launch_tasks?
114
+ end
107
115
  end
108
116
 
109
- if healthy?
117
+ if healthy? and launch_succeeded
110
118
  section('All computers launched correctly', :white)
111
119
  section('Applying aggregations:')
112
120
  all_computers(*@name_args).aggregate
121
+ else
122
+ section('Some computers could not be launched')
123
+ exit 1
113
124
  end
114
125
 
115
126
  display(target)
@@ -48,7 +48,6 @@ module Ironfan
48
48
  def discover_computers(realm_name, cluster_name, facet_name, slice_indexes)
49
49
  realm = Ironfan.load_realm(realm_name)
50
50
  realm.clusters.each{ |cluster| Ironfan.load_cluster cluster.name }
51
- realm.resolve!
52
51
  clusters = cluster_name ? Array(realm.clusters[cluster_name.to_sym]) : realm.clusters.to_a
53
52
  return broker.discover!(clusters, config[:cloud])
54
53
  end
@@ -27,6 +27,10 @@ module Ironfan
27
27
  self.cluster_role Ironfan::Dsl::Role.new(name: Compute.cluster_role_name(realm_name, cluster_name))
28
28
  end
29
29
 
30
+ def resolve
31
+ self.class.definitions[name.to_sym] = super
32
+ end
33
+
30
34
  # Utility method to reference all servers from constituent facets
31
35
  def servers
32
36
  result = Gorillib::ModelCollection.new(item_type: Ironfan::Dsl::Server, key_method: :full_name)
@@ -173,18 +173,16 @@ module Ironfan
173
173
  launch_desc = launch_description(computer)
174
174
  Chef::Log.debug(JSON.pretty_generate(launch_desc))
175
175
 
176
- Ironfan.safely do
177
- fog_server = Ec2.connection.servers.create(launch_desc)
178
- machine = Machine.new(:adaptee => fog_server)
179
- computer.machine = machine
180
- remember machine, :id => computer.name
181
-
182
- Ironfan.step(fog_server.id,"waiting for machine to be ready", :gray)
183
- Ironfan.tell_you_thrice :name => fog_server.id,
184
- :problem => "server unavailable",
185
- :error_class => Fog::Errors::Error do
186
- fog_server.wait_for { ready? }
187
- end
176
+ fog_server = Ec2.connection.servers.create(launch_desc)
177
+ machine = Machine.new(:adaptee => fog_server)
178
+ computer.machine = machine
179
+ remember machine, :id => computer.name
180
+
181
+ Ironfan.step(fog_server.id,"waiting for machine to be ready", :gray)
182
+ Ironfan.tell_you_thrice :name => fog_server.id,
183
+ :problem => "server unavailable",
184
+ :error_class => Fog::Errors::Error do
185
+ fog_server.wait_for { ready? }
188
186
  end
189
187
 
190
188
  # tag the computer correctly
@@ -152,7 +152,12 @@ module Ironfan
152
152
  vpc_id = tokens.pop
153
153
  Ec2.connection.create_security_group(group_id,"Ironfan created group #{group_id}",vpc_id)
154
154
  rescue Fog::Compute::AWS::Error => e # InvalidPermission.Duplicate
155
- Chef::Log.info("ignoring security group error: #{e}")
155
+ case e.message
156
+ when /SecurityGroupLimitExceeded/
157
+ raise e
158
+ else
159
+ Chef::Log.info("ignoring security group error: #{e}")
160
+ end
156
161
  end
157
162
  end
158
163
  end
@@ -1,3 +1,3 @@
1
1
  module Ironfan
2
- VERSION = '6.1.0'
2
+ VERSION = '6.1.3'
3
3
  end
data/lib/ironfan.rb CHANGED
@@ -31,10 +31,10 @@ module Ironfan
31
31
  return existing if attrs.empty? && !block_given?
32
32
  if existing
33
33
  existing.receive!(attrs, &blk)
34
- # existing.resolve!
34
+ existing.resolve!
35
35
  else
36
36
  cl = Ironfan::Dsl::Cluster.define(attrs.merge(name: name.to_sym), &blk)
37
- # cl.resolve!
37
+ cl.resolve!
38
38
  end
39
39
  end
40
40
 
@@ -43,10 +43,10 @@ module Ironfan
43
43
  return existing if attrs.empty? && !block_given?
44
44
  if existing
45
45
  existing.receive!(attrs, &blk)
46
- # existing.resolve!
46
+ existing.resolve!
47
47
  else
48
48
  rlm = Ironfan::Dsl::Realm.define(attrs.merge(name: name.to_sym), &blk)
49
- # rlm.resolve!
49
+ rlm.resolve!
50
50
  end
51
51
  end
52
52
 
@@ -102,11 +102,14 @@ describe Ironfan::Dsl::Realm do
102
102
  it 'should create clusters that can be edited later' do
103
103
  Ironfan.realm :xy do
104
104
  cluster(:baz)
105
- cluster(:baz){ facet :bif }
106
105
  end
107
106
 
108
- Ironfan.cluster(:baz).facets.to_a.should_not(be_empty)
109
- Ironfan.cluster(:baz).servers.to_a.first.should_not(be_nil)
107
+ Ironfan.cluster(:baz) do
108
+ facet :bif
109
+ end
110
+
111
+ Ironfan.realm(:xy).cluster(:baz).facets.to_a.should_not(be_empty)
112
+ Ironfan.realm(:xy).cluster(:baz).servers.to_a.first.should_not(be_nil)
110
113
  end
111
114
 
112
115
  it 'should create clusters with names prefixed by its own' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ironfan
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.0
4
+ version: 6.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-04 00:00:00.000000000 Z
12
+ date: 2014-04-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef
@@ -318,7 +318,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
318
318
  version: '0'
319
319
  segments:
320
320
  - 0
321
- hash: 1983446031386045195
321
+ hash: -2080363730222460341
322
322
  required_rubygems_version: !ruby/object:Gem::Requirement
323
323
  none: false
324
324
  requirements:
@@ -327,7 +327,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
327
327
  version: '0'
328
328
  segments:
329
329
  - 0
330
- hash: 1983446031386045195
330
+ hash: -2080363730222460341
331
331
  requirements: []
332
332
  rubyforge_project:
333
333
  rubygems_version: 1.8.25