From 930b8378a1d39bfd158e1da6c192e3d3c8a34f9e Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Wed, 7 Aug 2019 02:16:43 +0200 Subject: [PATCH 1/8] [mod] remove unused variable --- src/yunohost/app.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/yunohost/app.py b/src/yunohost/app.py index 4a14c5e4b..1bab5eb31 100644 --- a/src/yunohost/app.py +++ b/src/yunohost/app.py @@ -590,9 +590,6 @@ def app_upgrade(app=[], url=None, file=None): from yunohost.hook import hook_add, hook_remove, hook_exec, hook_callback from yunohost.permission import permission_sync_to_user - # Retrieve interface - is_api = msettings.get('interface') == 'api' - try: app_list() except YunohostError: From 3130bb59ace5fa2ffdbe8ad275e2c76be55ea74d Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Wed, 7 Aug 2019 02:28:37 +0200 Subject: [PATCH 2/8] [mod] stop apps upgrade if one upgrade fail --- locales/en.json | 3 ++- src/yunohost/app.py | 19 +++++++++++++------ 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/locales/en.json b/locales/en.json index be00d5b1e..cf15bb6f5 100644 --- a/locales/en.json +++ b/locales/en.json @@ -28,7 +28,8 @@ "app_location_unavailable": "This url is not available or conflicts with the already installed app(s):\n{apps:s}", "app_manifest_invalid": "Invalid app manifest: {error}", "app_no_upgrade": "No apps to upgrade", - "app_not_upgraded": "The following apps were not upgraded: {apps}", + "app_not_upgraded": "The following apps were not upgraded because a the app '{app}' failed to upgrade: {apps}", + "app_upgrade_stoped": "The upgrade of alls applications has been stopped to prevent possible dommages because the previous application failed to upgrade", "app_not_correctly_installed": "{app:s} seems to be incorrectly installed", "app_not_installed": "The application '{app:s}' is not installed. Here is the list of all installed apps: {all_apps}", "app_not_properly_removed": "{app:s} has not been properly removed", diff --git a/src/yunohost/app.py b/src/yunohost/app.py index 1bab5eb31..a45766907 100644 --- a/src/yunohost/app.py +++ b/src/yunohost/app.py @@ -618,7 +618,7 @@ def app_upgrade(app=[], url=None, file=None): if len(apps) > 1: logger.info(m18n.n("app_upgrade_several_apps", apps=", ".join(apps))) - for app_instance_name in apps: + for number, app_instance_name in enumerate(apps): logger.info(m18n.n('app_upgrade_app_name', app=app_instance_name)) app_dict = app_info(app_instance_name, raw=True) @@ -672,9 +672,19 @@ def app_upgrade(app=[], url=None, file=None): if hook_exec(extracted_app_folder + '/scripts/upgrade', args=args_list, env=env_dict)[0] != 0: msg = m18n.n('app_upgrade_failed', app=app_instance_name) - not_upgraded_apps.append(app_instance_name) - logger.error(msg) operation_logger.error(msg) + + # display this is there are remaining apps + if apps[number + 1:]: + logger.error(m18n.n('app_upgrade_stoped')) + not_upgraded_apps = apps[number:] + # we don't want to continue upgrading apps here in case that breaks + # everything + raise YunohostError('app_not_upgraded', + failed_app=app_instance_name, + apps=', '.join(not_upgraded_apps)) + else: + raise YunohostError(msg) else: now = int(time.time()) # TODO: Move install_time away from app_setting @@ -709,9 +719,6 @@ def app_upgrade(app=[], url=None, file=None): hook_callback('post_app_upgrade', args=args_list, env=env_dict) operation_logger.success() - if not_upgraded_apps: - raise YunohostError('app_not_upgraded', apps=', '.join(not_upgraded_apps)) - permission_sync_to_user() logger.success(m18n.n('upgrade_complete')) From 889e34888dede81aa5532ebbccdedb055a86ab3b Mon Sep 17 00:00:00 2001 From: Bram Date: Wed, 7 Aug 2019 13:04:56 +0200 Subject: [PATCH 3/8] [mod] typo Co-Authored-By: decentral1se --- src/yunohost/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/yunohost/app.py b/src/yunohost/app.py index a45766907..0ada585c3 100644 --- a/src/yunohost/app.py +++ b/src/yunohost/app.py @@ -674,7 +674,7 @@ def app_upgrade(app=[], url=None, file=None): msg = m18n.n('app_upgrade_failed', app=app_instance_name) operation_logger.error(msg) - # display this is there are remaining apps + # display this if there are remaining apps if apps[number + 1:]: logger.error(m18n.n('app_upgrade_stoped')) not_upgraded_apps = apps[number:] From 22be1a320b357c0ce652124d46bb369e1049f324 Mon Sep 17 00:00:00 2001 From: Bram Date: Wed, 7 Aug 2019 13:05:13 +0200 Subject: [PATCH 4/8] [mod] typo Co-Authored-By: decentral1se --- locales/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locales/en.json b/locales/en.json index cf15bb6f5..c8bee8610 100644 --- a/locales/en.json +++ b/locales/en.json @@ -29,7 +29,7 @@ "app_manifest_invalid": "Invalid app manifest: {error}", "app_no_upgrade": "No apps to upgrade", "app_not_upgraded": "The following apps were not upgraded because a the app '{app}' failed to upgrade: {apps}", - "app_upgrade_stoped": "The upgrade of alls applications has been stopped to prevent possible dommages because the previous application failed to upgrade", + "app_upgrade_stoped": "The upgrade of all applications has been stopped to prevent possible damage because the previous application failed to upgrade", "app_not_correctly_installed": "{app:s} seems to be incorrectly installed", "app_not_installed": "The application '{app:s}' is not installed. Here is the list of all installed apps: {all_apps}", "app_not_properly_removed": "{app:s} has not been properly removed", From 7926b761fd9abea76ff843778a81ec643d84f45e Mon Sep 17 00:00:00 2001 From: Bram Date: Wed, 7 Aug 2019 13:05:50 +0200 Subject: [PATCH 5/8] [mod] typo Co-Authored-By: decentral1se --- locales/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locales/en.json b/locales/en.json index c8bee8610..741af8c6a 100644 --- a/locales/en.json +++ b/locales/en.json @@ -28,7 +28,7 @@ "app_location_unavailable": "This url is not available or conflicts with the already installed app(s):\n{apps:s}", "app_manifest_invalid": "Invalid app manifest: {error}", "app_no_upgrade": "No apps to upgrade", - "app_not_upgraded": "The following apps were not upgraded because a the app '{app}' failed to upgrade: {apps}", + "app_not_upgraded": "The following apps were not upgraded because the app '{app}' failed to upgrade: {apps}", "app_upgrade_stoped": "The upgrade of all applications has been stopped to prevent possible damage because the previous application failed to upgrade", "app_not_correctly_installed": "{app:s} seems to be incorrectly installed", "app_not_installed": "The application '{app:s}' is not installed. Here is the list of all installed apps: {all_apps}", From a283b436e173f16bd84e46da4669753f4f7c8bbb Mon Sep 17 00:00:00 2001 From: Bram Date: Sun, 18 Aug 2019 18:50:20 +0200 Subject: [PATCH 6/8] [mod] typo Co-Authored-By: Alexandre Aubin --- locales/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locales/en.json b/locales/en.json index 741af8c6a..22dd59bb2 100644 --- a/locales/en.json +++ b/locales/en.json @@ -29,7 +29,7 @@ "app_manifest_invalid": "Invalid app manifest: {error}", "app_no_upgrade": "No apps to upgrade", "app_not_upgraded": "The following apps were not upgraded because the app '{app}' failed to upgrade: {apps}", - "app_upgrade_stoped": "The upgrade of all applications has been stopped to prevent possible damage because the previous application failed to upgrade", + "app_upgrade_stopped": "The upgrade of all applications has been stopped to prevent possible damage because the previous application failed to upgrade", "app_not_correctly_installed": "{app:s} seems to be incorrectly installed", "app_not_installed": "The application '{app:s}' is not installed. Here is the list of all installed apps: {all_apps}", "app_not_properly_removed": "{app:s} has not been properly removed", From ef38f5e7b5f2a893f416baca7fccf164cf2fed81 Mon Sep 17 00:00:00 2001 From: Bram Date: Sun, 18 Aug 2019 18:51:16 +0200 Subject: [PATCH 7/8] [mod] typo Co-Authored-By: Alexandre Aubin --- src/yunohost/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/yunohost/app.py b/src/yunohost/app.py index 0ada585c3..684d83569 100644 --- a/src/yunohost/app.py +++ b/src/yunohost/app.py @@ -676,7 +676,7 @@ def app_upgrade(app=[], url=None, file=None): # display this if there are remaining apps if apps[number + 1:]: - logger.error(m18n.n('app_upgrade_stoped')) + logger.error(m18n.n('app_upgrade_stopped')) not_upgraded_apps = apps[number:] # we don't want to continue upgrading apps here in case that breaks # everything From fc85ae010229ac3f8efee0ab5c16f12133edabfc Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 15 Sep 2019 01:42:04 +0200 Subject: [PATCH 8/8] Key mismatch was causing an error + ended up reworking the sentence --- locales/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locales/en.json b/locales/en.json index 22dd59bb2..e520c442d 100644 --- a/locales/en.json +++ b/locales/en.json @@ -28,7 +28,7 @@ "app_location_unavailable": "This url is not available or conflicts with the already installed app(s):\n{apps:s}", "app_manifest_invalid": "Invalid app manifest: {error}", "app_no_upgrade": "No apps to upgrade", - "app_not_upgraded": "The following apps were not upgraded because the app '{app}' failed to upgrade: {apps}", + "app_not_upgraded": "The app '{failed_app}' failed to upgrade, and as a consequence the following apps upgrades have been cancelled: {apps}", "app_upgrade_stopped": "The upgrade of all applications has been stopped to prevent possible damage because the previous application failed to upgrade", "app_not_correctly_installed": "{app:s} seems to be incorrectly installed", "app_not_installed": "The application '{app:s}' is not installed. Here is the list of all installed apps: {all_apps}",