Improve message when some upgrades fail

This commit is contained in:
Alexandre Aubin 2019-02-16 14:38:39 +01:00
parent 562b3b98f6
commit 7d3319332d
2 changed files with 6 additions and 3 deletions

View file

@ -24,7 +24,8 @@
"app_location_install_failed": "Unable to install the app in this location because it conflit with the app '{other_app}' already installed on '{other_path}'", "app_location_install_failed": "Unable to install the app in this location because it conflit with the app '{other_app}' already installed on '{other_path}'",
"app_location_unavailable": "This url is not available or conflicts with the already installed app(s):\n{apps:s}", "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_manifest_invalid": "Invalid app manifest: {error}",
"app_no_upgrade": "No app to upgrade", "app_no_upgrade": "No apps to upgrade",
"app_not_upgraded": "The following apps were not upgraded: {apps}",
"app_not_correctly_installed": "{app:s} seems to be incorrectly installed", "app_not_correctly_installed": "{app:s} seems to be incorrectly installed",
"app_not_installed": "{app:s} is not installed", "app_not_installed": "{app:s} is not installed",
"app_not_properly_removed": "{app:s} has not been properly removed", "app_not_properly_removed": "{app:s} has not been properly removed",

View file

@ -575,6 +575,7 @@ def app_upgrade(auth, app=[], url=None, file=None):
raise YunohostError('app_no_upgrade') raise YunohostError('app_no_upgrade')
upgraded_apps = [] upgraded_apps = []
not_upgraded_apps = []
apps = app apps = app
user_specified_list = True user_specified_list = True
@ -651,6 +652,7 @@ def app_upgrade(auth, app=[], url=None, file=None):
if hook_exec(extracted_app_folder + '/scripts/upgrade', if hook_exec(extracted_app_folder + '/scripts/upgrade',
args=args_list, env=env_dict) != 0: args=args_list, env=env_dict) != 0:
msg = m18n.n('app_upgrade_failed', app=app_instance_name) msg = m18n.n('app_upgrade_failed', app=app_instance_name)
not_upgraded_apps.append(app_instance_name)
logger.error(msg) logger.error(msg)
operation_logger.error(msg) operation_logger.error(msg)
else: else:
@ -684,8 +686,8 @@ def app_upgrade(auth, app=[], url=None, file=None):
hook_callback('post_app_upgrade', args=args_list, env=env_dict) hook_callback('post_app_upgrade', args=args_list, env=env_dict)
operation_logger.success() operation_logger.success()
if not upgraded_apps: if not_upgraded_apps:
raise YunohostError('app_no_upgrade') raise YunohostError('app_not_upgraded', apps=', '.join(not_upgraded_apps))
app_ssowatconf(auth) app_ssowatconf(auth)