From 8c4d136a7f30e823b09345c1eb0b2912722024f2 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sat, 13 Jul 2019 18:29:37 +0200 Subject: [PATCH] Check python hook did return the expected format --- src/yunohost/hook.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/yunohost/hook.py b/src/yunohost/hook.py index 8c679b601..a9fd3186c 100644 --- a/src/yunohost/hook.py +++ b/src/yunohost/hook.py @@ -462,7 +462,13 @@ def _hook_exec_python(path, args, env, loggers): # TODO : We might want to check here that it's a tuple # containing an int + a dict ? - return module.main(args, env, loggers) + ret = module.main(args, env, loggers) + assert isinstance(ret, tuple) \ + and len(ret) == 2 \ + and isinstance(ret[0],int) \ + and isinstance(ret[1],dict), \ + "Module %s did not return a (int, dict) tuple !" % module + return ret def _extract_filename_parts(filename):