2010/2/26 Guido Trotter <[email protected]>:
> --- a/daemons/ganeti-watcher
> +++ b/daemons/ganeti-watcher
> @@ -93,6 +93,30 @@ def StartNodeDaemons():
> # start confd as well. On non candidates it will be in disabled mode.
> EnsureDaemon(constants.CONFD)
>
> +def RunWatcherHooks():
Two empty lines at module level.
> + """Run the watcher hooks.
> +
> + """
> + hooks_dir = os.path.join(constants.HOOKS_BASE_DIR,
> + constants.HOOKS_NAME_WATCHER)
> +
> + try:
> + results = utils.RunParts(hooks_dir)
> + except Exception, msg: # pylint: disable-msg=W0703
> + logging.critical("RunParts %s failed: %s", hooks_dir, msg)
> +
> + for (relname, status, runresult) in results:
> + if status == constants.RUNPARTS_SKIP:
> + logging.debug("Watcher Hook %s: skipped", relname)
s/Hook/hook/ (also in other log messages)
> + elif status == constants.RUNPARTS_ERR:
> + logging.warning("Watcher Hook %s: error (%s)", relname, runresult)
> + elif status == constants.RUNPARTS_RUN:
> + if runresult.failed:
> + logging.warning("Watcher Hook %s: failed (exit: %d) (output: %s)",
> + relname, runresult.exit_code, runresult.output)
> + else:
> + logging.debug("Watcher Hook %s: success (output: %s)", relname,
> + runresult.output)
Rest LGTM.