Commit a9b7e346 authored by Iustin Pop's avatar Iustin Pop

Remove superfluous warnings in HooksRunner

For non-existing hooks (the majority of cases probably), logging a
warning every time is not helpful. So we first check if we have a valid
directory.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent c4feafe8
......@@ -2679,9 +2679,16 @@ class HooksRunner(object):
subdir = "%s-%s.d" % (hpath, suffix)
dir_name = "%s/%s" % (self._BASE_DIR, subdir)
runparts_results = utils.RunParts(dir_name, env=env, reset_env=True)
results = []
if not os.path.isdir(dir_name):
# for non-existing/non-dirs, we simply exit instead of logging a
# warning at every operation
return results
runparts_results = utils.RunParts(dir_name, env=env, reset_env=True)
for (relname, relstatus, runresult) in runparts_results:
if relstatus == constants.RUNPARTS_SKIP:
rrval = constants.HKR_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