Commit a0aa6b49 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Fix bug in watcher



If “utils.RunParts” were to raise an exception, a log message was
written and the code continued to run. Due to the exception the
“results” variable would not be defined.

Also change the code to log a backtrace (getting an exception is rather
unlikely and having a backtrace is useful) and update one comment.
Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent 4a2c0db0
......@@ -71,7 +71,7 @@ KEY_RESTART_WHEN = "restart_when"
KEY_BOOT_ID = "bootid"
# Global client object
# Global LUXI client object
client = None
......@@ -107,8 +107,9 @@ def RunWatcherHooks():
try:
results = utils.RunParts(hooks_dir)
except Exception, msg: # pylint: disable-msg=W0703
logging.critical("RunParts %s failed: %s", hooks_dir, msg)
except Exception: # pylint: disable-msg=W0703
logging.exception("RunParts %s failed: %s", hooks_dir)
return
for (relname, status, runresult) in results:
if status == constants.RUNPARTS_SKIP:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment