Revision 54ca6e4b lib/watcher/__init__.py
b/lib/watcher/__init__.py | ||
---|---|---|
280 | 280 |
|
281 | 281 |
for instance in self.instances.values(): |
282 | 282 |
if instance.status in BAD_STATES: |
283 |
n = notepad.NumberOfRestartAttempts(instance) |
|
283 |
n = notepad.NumberOfRestartAttempts(instance.name)
|
|
284 | 284 |
|
285 | 285 |
if n > MAXTRIES: |
286 | 286 |
logging.warning("Not restarting instance %s, retries exhausted", |
... | ... | |
289 | 289 |
elif n < MAXTRIES: |
290 | 290 |
last = " (Attempt #%d)" % (n + 1) |
291 | 291 |
else: |
292 |
notepad.RecordRestartAttempt(instance) |
|
292 |
notepad.RecordRestartAttempt(instance.name)
|
|
293 | 293 |
logging.error("Could not restart %s after %d attempts, giving up", |
294 | 294 |
instance.name, MAXTRIES) |
295 | 295 |
continue |
... | ... | |
301 | 301 |
logging.exception("Error while restarting instance %s", |
302 | 302 |
instance.name) |
303 | 303 |
|
304 |
notepad.RecordRestartAttempt(instance) |
|
304 |
notepad.RecordRestartAttempt(instance.name)
|
|
305 | 305 |
elif instance.status in HELPLESS_STATES: |
306 |
if notepad.NumberOfRestartAttempts(instance): |
|
307 |
notepad.RemoveInstance(instance) |
|
306 |
if notepad.NumberOfRestartAttempts(instance.name):
|
|
307 |
notepad.RemoveInstance(instance.name)
|
|
308 | 308 |
else: |
309 |
if notepad.NumberOfRestartAttempts(instance): |
|
310 |
notepad.RemoveInstance(instance) |
|
309 |
if notepad.NumberOfRestartAttempts(instance.name):
|
|
310 |
notepad.RemoveInstance(instance.name)
|
|
311 | 311 |
logging.info("Restart of %s succeeded", instance.name) |
312 | 312 |
|
313 | 313 |
def _CheckForOfflineNodes(self, instance): |
... | ... | |
511 | 511 |
|
512 | 512 |
finally: |
513 | 513 |
if update_file: |
514 |
notepad.Save() |
|
514 |
notepad.Save(constants.WATCHER_STATEFILE)
|
|
515 | 515 |
else: |
516 | 516 |
logging.debug("Not updating status file due to failure") |
517 | 517 |
except SystemExit: |
Also available in: Unified diff