mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
apps/helpers2.1: fix app env in resource upgrade context ending up in incorrect helper version being used
This commit is contained in:
parent
2af4c157d9
commit
ed426f05ba
2 changed files with 6 additions and 5 deletions
|
@ -770,7 +770,7 @@ def app_upgrade(
|
|||
from yunohost.utils.resources import AppResourceManager
|
||||
|
||||
AppResourceManager(
|
||||
app_instance_name, wanted=manifest, current=app_dict["manifest"]
|
||||
app_instance_name, wanted=manifest, current=app_dict["manifest"], workdir=extracted_app_folder
|
||||
).apply(
|
||||
rollback_and_raise_exception_if_failure=True,
|
||||
operation_logger=operation_logger,
|
||||
|
|
|
@ -39,10 +39,11 @@ logger = getActionLogger("yunohost.app_resources")
|
|||
|
||||
|
||||
class AppResourceManager:
|
||||
def __init__(self, app: str, current: Dict, wanted: Dict):
|
||||
def __init__(self, app: str, current: Dict, wanted: Dict, workdir=None):
|
||||
self.app = app
|
||||
self.current = current
|
||||
self.wanted = wanted
|
||||
self.workdir = workdir
|
||||
|
||||
if "resources" not in self.current:
|
||||
self.current["resources"] = {}
|
||||
|
@ -256,17 +257,17 @@ class AppResource:
|
|||
)
|
||||
from yunohost.hook import hook_exec_with_script_debug_if_failure
|
||||
|
||||
tmpdir = _make_tmp_workdir_for_app(app=self.app)
|
||||
workdir = self.manager.workdir if self.manager and self.manager.workdir else _make_tmp_workdir_for_app(app=self.app)
|
||||
|
||||
env_ = _make_environment_for_app_script(
|
||||
self.app,
|
||||
workdir=tmpdir,
|
||||
workdir=workdir,
|
||||
action=f"{action}_{self.type}",
|
||||
force_include_app_settings=True,
|
||||
)
|
||||
env_.update(env)
|
||||
|
||||
script_path = f"{tmpdir}/{action}_{self.type}"
|
||||
script_path = f"{workdir}/{action}_{self.type}"
|
||||
script = f"""
|
||||
source /usr/share/yunohost/helpers
|
||||
ynh_abort_if_errors
|
||||
|
|
Loading…
Add table
Reference in a new issue