From 15b3733e2241cdc8322e19399827c2f65772399f Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 26 Feb 2019 02:34:02 +0100 Subject: [PATCH] Don't raise an exception in the middle of the loop, that check can be done before --- src/yunohost/app.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/yunohost/app.py b/src/yunohost/app.py index a91ba61eb..be0bb5a55 100644 --- a/src/yunohost/app.py +++ b/src/yunohost/app.py @@ -594,6 +594,10 @@ def app_upgrade(auth, app=[], url=None, file=None): # Remove possible duplicates apps = [app for i,app in enumerate(apps) if apps not in apps[:i]] + # Abort if any of those app is in fact not installed.. + for app in [app for app in apps if not _is_installed(app)]: + raise YunohostError('app_not_installed', app=app) + if len(apps) == 0: raise YunohostError('app_no_upgrade') if len(apps) > 1: @@ -601,9 +605,6 @@ def app_upgrade(auth, app=[], url=None, file=None): for app_instance_name in apps: logger.info(m18n.n('app_upgrade_app_name', app=app_instance_name)) - installed = _is_installed(app_instance_name) - if not installed: - raise YunohostError('app_not_installed', app=app_instance_name) app_dict = app_info(app_instance_name, raw=True)