From d766e74a6a46aabcfa9a87bada7ef8ab9e4e9676 Mon Sep 17 00:00:00 2001 From: axolotle Date: Sat, 26 Nov 2022 13:52:19 +0100 Subject: [PATCH] app_install: return post_install notifs to API --- src/app.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/app.py b/src/app.py index 9740aa206..0f8a71f23 100644 --- a/src/app.py +++ b/src/app.py @@ -1183,18 +1183,23 @@ def app_install( logger.success(m18n.n("installation_complete")) + # Get the generated settings to hydrate notifications + settings = _get_app_settings(app_instance_name) + notifications = _filter_and_hydrate_notifications( + manifest["notifications"]["post_install"], data=settings + ) + # Display post_install notices in cli mode - if manifest["notifications"]["post_install"] and Moulinette.interface.type == "cli": - # Get the generated settings to hydrate notifications - settings = _get_app_settings(app_instance_name) - notifications = _filter_and_hydrate_notifications( - manifest["notifications"]["post_install"], data=settings - ) + if notifications and Moulinette.interface.type == "cli": _display_notifications(notifications, force=force) # Call postinstall hook hook_callback("post_app_install", env=env_dict) + # Return hydrated post install notif for API + if Moulinette.interface.type == "api": + return {"notifications": notifications} + @is_unit_operation() def app_remove(operation_logger, app, purge=False):