mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
app_upgrade: display pre and post notifications
This commit is contained in:
parent
cdcd967eb1
commit
c4432b7823
1 changed files with 28 additions and 0 deletions
28
src/app.py
28
src/app.py
|
@ -598,6 +598,19 @@ def app_upgrade(app=[], url=None, file=None, force=False, no_safety_backup=False
|
||||||
else:
|
else:
|
||||||
raise YunohostValidationError(err, **values)
|
raise YunohostValidationError(err, **values)
|
||||||
|
|
||||||
|
# Display pre-upgrade notifications and ask for simple confirm
|
||||||
|
if (
|
||||||
|
manifest["notifications"]["pre_upgrade"]
|
||||||
|
and Moulinette.interface.type == "cli"
|
||||||
|
):
|
||||||
|
settings = _get_app_settings(app_instance_name)
|
||||||
|
notifications = _filter_and_hydrate_notifications(
|
||||||
|
manifest["notifications"]["pre_upgrade"],
|
||||||
|
current_version=app_current_version,
|
||||||
|
data=settings,
|
||||||
|
)
|
||||||
|
_display_notifications(notifications, force=force)
|
||||||
|
|
||||||
if manifest["packaging_format"] >= 2:
|
if manifest["packaging_format"] >= 2:
|
||||||
if no_safety_backup:
|
if no_safety_backup:
|
||||||
# FIXME: i18n
|
# FIXME: i18n
|
||||||
|
@ -780,6 +793,21 @@ def app_upgrade(app=[], url=None, file=None, force=False, no_safety_backup=False
|
||||||
# So much win
|
# So much win
|
||||||
logger.success(m18n.n("app_upgraded", app=app_instance_name))
|
logger.success(m18n.n("app_upgraded", app=app_instance_name))
|
||||||
|
|
||||||
|
# Display post-upgrade notifications and ask for simple confirm
|
||||||
|
if (
|
||||||
|
manifest["notifications"]["post_upgrade"]
|
||||||
|
and Moulinette.interface.type == "cli"
|
||||||
|
):
|
||||||
|
# Get updated settings to hydrate notifications
|
||||||
|
settings = _get_app_settings(app_instance_name)
|
||||||
|
notifications = _filter_and_hydrate_notifications(
|
||||||
|
manifest["notifications"]["post_upgrade"],
|
||||||
|
current_version=app_current_version,
|
||||||
|
data=settings,
|
||||||
|
)
|
||||||
|
_display_notifications(notifications, force=force)
|
||||||
|
# FIXME Should return a response with post upgrade notif formatted with the newest settings to the web-admin
|
||||||
|
|
||||||
hook_callback("post_app_upgrade", env=env_dict)
|
hook_callback("post_app_upgrade", env=env_dict)
|
||||||
operation_logger.success()
|
operation_logger.success()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue