ironfan 4.9.4 → 4.9.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/VERSION +1 -1
- data/ironfan.gemspec +1 -1
- data/lib/ironfan/provider/ec2/machine.rb +3 -12
- data/lib/ironfan.rb +27 -0
- metadata +2 -2
data/CHANGELOG.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
4.9.
|
1
|
+
4.9.5
|
data/ironfan.gemspec
CHANGED
@@ -170,20 +170,11 @@ module Ironfan
|
|
170
170
|
computer.machine = machine
|
171
171
|
remember machine, :id => computer.name
|
172
172
|
|
173
|
-
# Trying a more brute force "I tell you 3 times", to get around
|
174
|
-
# https://github.com/infochimps-labs/ironfan/issues/271
|
175
173
|
Ironfan.step(fog_server.id,"waiting for machine to be ready", :gray)
|
176
|
-
|
174
|
+
Ironfan.tell_you_thrice :name => fog_server.id,
|
175
|
+
:problem => "server unavailable",
|
176
|
+
:error_class => Fog::Errors::Error do
|
177
177
|
fog_server.wait_for { ready? }
|
178
|
-
rescue Fog::Errors::Error => e
|
179
|
-
try ||= 0
|
180
|
-
raise if try > 3
|
181
|
-
try += 1
|
182
|
-
pause_for = 3 * try
|
183
|
-
Ironfan.step(fog_server.id,"rescue ##{try}, sleeping #{pause_for} seconds")
|
184
|
-
Chef::Log.debug "Error was #{e.inspect}"
|
185
|
-
sleep pause_for
|
186
|
-
retry
|
187
178
|
end
|
188
179
|
end
|
189
180
|
|
data/lib/ironfan.rb
CHANGED
@@ -141,6 +141,33 @@ module Ironfan
|
|
141
141
|
end
|
142
142
|
end
|
143
143
|
|
144
|
+
#
|
145
|
+
# Utility to retry a flaky operation three times, with ascending wait times
|
146
|
+
#
|
147
|
+
def self.tell_you_thrice(options={})
|
148
|
+
options = { name: "problem",
|
149
|
+
problem: nil,
|
150
|
+
error_class: StandardError,
|
151
|
+
retries: 3,
|
152
|
+
multiplier: 3 }.merge!(options)
|
153
|
+
try = 0
|
154
|
+
message = ''
|
155
|
+
|
156
|
+
begin
|
157
|
+
yield
|
158
|
+
rescue error_class => err
|
159
|
+
raise if try > retries
|
160
|
+
try += 1
|
161
|
+
pause_for = multiplier * try
|
162
|
+
message += "#{problem}, " unless problem.nil?
|
163
|
+
message += "sleeping #{pause_for} seconds"
|
164
|
+
Ironfan.step(name, message, :gray)
|
165
|
+
Chef::Log.debug "Error was #{err.inspect}"
|
166
|
+
sleep pause_for
|
167
|
+
retry
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
144
171
|
#
|
145
172
|
# Utility to show a step of the overall process
|
146
173
|
#
|
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: 4.9.
|
4
|
+
version: 4.9.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -359,7 +359,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
359
359
|
version: '0'
|
360
360
|
segments:
|
361
361
|
- 0
|
362
|
-
hash: -
|
362
|
+
hash: -484279386276054459
|
363
363
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
364
364
|
none: false
|
365
365
|
requirements:
|