From 3facf89c7ed320a3d6ec6afb6e4aca46b4c89c08 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Thu, 19 Jul 2018 01:13:23 +0200 Subject: [PATCH] [enh] allow to uses in action cwd --- src/yunohost/app.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/yunohost/app.py b/src/yunohost/app.py index 2287723bf..7961591e7 100644 --- a/src/yunohost/app.py +++ b/src/yunohost/app.py @@ -1412,11 +1412,16 @@ def app_action_run(app_id, action, args=None): os.chmod(path, 700) + if action_declaration.get("cwd"): + cwd = action_declaration["cwd"].replace("$app_id", app_id) + else: + cwd = "/etc/yunohost/apps/" + app_id + retcode = hook_exec( path, args=args_list, env=env_dict, - chdir=action_declaration.get("cwd", "/etc/yunohost/apps/" + app_id), + chdir=cwd, user=action_declaration.get("user", "root"), )