appsv2/regenconf: prevent set -u to be enabled during regen-conf triggered from inside appsv2 scripts

This commit is contained in:
Alexandre Aubin 2023-05-04 17:02:35 +02:00
parent d5cc3dc13d
commit a7350a7eae
3 changed files with 4 additions and 1 deletions

View file

@ -65,7 +65,7 @@ ynh_abort_if_errors() {
}
# When running an app script with packaging format >= 2, auto-enable ynh_abort_if_errors except for remove script
if dpkg --compare-versions ${YNH_APP_PACKAGING_FORMAT:-0} ge 2 && [[ ${YNH_APP_ACTION} != "remove" ]]
if [[ "${YNH_CONTEXT:-}" != "regenconf" ]] && dpkg --compare-versions ${YNH_APP_PACKAGING_FORMAT:-0} ge 2 && [[ ${YNH_APP_ACTION} != "remove" ]]
then
ynh_abort_if_errors
fi

View file

@ -452,6 +452,8 @@ def _hook_exec_bash(path, args, chdir, env, user, return_format, loggers):
logger.debug("Executing command '%s'" % command)
_env = os.environ.copy()
if "YNH_CONTEXT" in _env:
del _env["YNH_CONTEXT"]
_env.update(env)
# Remove the 'HOME' var which is causing some inconsistencies between

View file

@ -139,6 +139,7 @@ def regen_conf(
env["YNH_MAIN_DOMAINS"] = " ".join(
domain_list(exclude_subdomains=True)["domains"]
)
env["YNH_CONTEXT"] = "regenconf"
pre_result = hook_callback("conf_regen", names, pre_callback=_pre_call, env=env)