Add the possibility to have multiple path per hook name

This commit is contained in:
Josué Tille 2019-02-11 20:05:21 +01:00
parent cbf2c1f82a
commit 6ab5d71603
No known key found for this signature in database
GPG key ID: D5E068C6DFA8681D

View file

@ -283,14 +283,16 @@ def hook_callback(action, hooks=[], args=None, no_trace=False, chdir=None,
no_trace=no_trace, raise_on_error=True)[1] no_trace=no_trace, raise_on_error=True)[1]
except YunohostError as e: except YunohostError as e:
state = 'failed' state = 'failed'
hook_return = {}
logger.error(e.strerror, exc_info=1) logger.error(e.strerror, exc_info=1)
post_callback(name=name, priority=priority, path=path, post_callback(name=name, priority=priority, path=path,
succeed=False) succeed=False)
else: else:
post_callback(name=name, priority=priority, path=path, post_callback(name=name, priority=priority, path=path,
succeed=True) succeed=True)
if not name in result:
result[name] = {'path' : path, 'state' : state, 'stdreturn' : hook_return } result[name] = {}
result[name][path] = {'state' : state, 'stdreturn' : hook_return }
return result return result
@ -389,7 +391,7 @@ def hook_exec(path, args=None, raise_on_error=False, no_trace=False,
raise YunohostError('hook_exec_not_terminated', path=path) raise YunohostError('hook_exec_not_terminated', path=path)
else: else:
logger.error(m18n.n('hook_exec_not_terminated', path=path)) logger.error(m18n.n('hook_exec_not_terminated', path=path))
return 1, '' return 1, {}
elif raise_on_error and returncode != 0: elif raise_on_error and returncode != 0:
raise YunohostError('hook_exec_failed', path=path) raise YunohostError('hook_exec_failed', path=path)