mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
tools_update: add hydrated pre/post upgrade notifications
This commit is contained in:
parent
c4432b7823
commit
d0faf8a64a
2 changed files with 25 additions and 2 deletions
|
@ -164,6 +164,8 @@ def app_info(app, full=False, upgradable=False):
|
|||
ret["current_version"] = f" ({current_revision})"
|
||||
ret["new_version"] = f" ({new_revision})"
|
||||
|
||||
ret["settings"] = settings
|
||||
|
||||
if not full:
|
||||
return ret
|
||||
|
||||
|
@ -175,7 +177,6 @@ def app_info(app, full=False, upgradable=False):
|
|||
ret["manifest"]["install"] = _set_default_ask_questions(
|
||||
ret["manifest"].get("install", {})
|
||||
)
|
||||
ret["settings"] = settings
|
||||
|
||||
ret["from_catalog"] = from_catalog
|
||||
|
||||
|
|
24
src/tools.py
24
src/tools.py
|
@ -20,6 +20,7 @@ import re
|
|||
import os
|
||||
import subprocess
|
||||
import time
|
||||
import shutil
|
||||
from importlib import import_module
|
||||
from packaging import version
|
||||
from typing import List
|
||||
|
@ -29,7 +30,13 @@ from moulinette.utils.log import getActionLogger
|
|||
from moulinette.utils.process import call_async_output
|
||||
from moulinette.utils.filesystem import read_yaml, write_to_yaml, cp, mkdir, rm, chown
|
||||
|
||||
from yunohost.app import app_upgrade, app_list
|
||||
from yunohost.app import (
|
||||
app_upgrade,
|
||||
app_list,
|
||||
_filter_and_hydrate_notifications,
|
||||
_extract_app,
|
||||
_parse_app_instance_name,
|
||||
)
|
||||
from yunohost.app_catalog import (
|
||||
_initialize_apps_catalog_system,
|
||||
_update_apps_catalog,
|
||||
|
@ -365,6 +372,21 @@ def tools_update(target=None):
|
|||
|
||||
upgradable_apps = list(app_list(upgradable=True)["apps"])
|
||||
|
||||
# Retrieve next manifest notifications
|
||||
for app in upgradable_apps:
|
||||
absolute_app_name, _ = _parse_app_instance_name(app["id"])
|
||||
manifest, extracted_app_folder = _extract_app(absolute_app_name)
|
||||
current_version = version.parse(app["current_version"])
|
||||
app["notifications"] = {
|
||||
type_: _filter_and_hydrate_notifications(
|
||||
manifest["notifications"][type_], current_version, app["settings"]
|
||||
)
|
||||
for type_ in ("pre_upgrade", "post_upgrade")
|
||||
}
|
||||
# FIXME Post-upgrade notifs should be hydrated with post-upgrade app settings
|
||||
del app["settings"]
|
||||
shutil.rmtree(extracted_app_folder)
|
||||
|
||||
if len(upgradable_apps) == 0 and len(upgradable_system_packages) == 0:
|
||||
logger.info(m18n.n("already_up_to_date"))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue