From 297026e6548ef1763f6c5d51bef1c940f02e532d Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Sun, 7 Jan 2018 16:43:10 +0100 Subject: [PATCH 1/3] [fix] improve UX, previous message was unclear for users qsd --- locales/en.json | 2 +- src/yunohost/app.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/locales/en.json b/locales/en.json index 8dac6e799..6e6ed6daa 100644 --- a/locales/en.json +++ b/locales/en.json @@ -19,7 +19,7 @@ "app_incompatible": "The app is incompatible with your YunoHost version", "app_install_files_invalid": "Invalid installation files", "app_location_already_used": "An app is already installed in this location", - "app_location_install_failed": "Unable to install the app in this location", + "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 an already installed app", "app_manifest_invalid": "Invalid app manifest: {error}", "app_no_upgrade": "No app to upgrade", diff --git a/src/yunohost/app.py b/src/yunohost/app.py index 403e76cc4..5599c0d53 100644 --- a/src/yunohost/app.py +++ b/src/yunohost/app.py @@ -1169,10 +1169,12 @@ def app_checkurl(auth, url, app=None): continue if path == p: raise MoulinetteError(errno.EINVAL, - m18n.n('app_location_already_used')) + m18n.n('app_location_already_used', + app=a["id"], path=path)) elif path.startswith(p) or p.startswith(path): raise MoulinetteError(errno.EPERM, - m18n.n('app_location_install_failed')) + m18n.n('app_location_install_failed', + other_path=p, other_app=a['id'])) if app is not None and not installed: app_setting(app, 'domain', value=domain) From 9cd760defd74e815408ece4a7960631692681a0d Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Sun, 7 Jan 2018 17:04:48 +0100 Subject: [PATCH 2/3] [enh] make exceptions messages more obivous --- locales/en.json | 3 ++- src/yunohost/app.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/locales/en.json b/locales/en.json index 6e6ed6daa..1edf2609c 100644 --- a/locales/en.json +++ b/locales/en.json @@ -18,7 +18,8 @@ "app_id_invalid": "Invalid app id", "app_incompatible": "The app is incompatible with your YunoHost version", "app_install_files_invalid": "Invalid installation files", - "app_location_already_used": "An app is already installed in this location", + "app_location_already_used": "The app '{app}' is already installed on that location ({path})", + "app_make_default_location_already_used": "Can't make the app '{app}' the default on the domain {domain} is already used by the other app '{other_app}'", "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 an already installed app", "app_manifest_invalid": "Invalid app manifest: {error}", diff --git a/src/yunohost/app.py b/src/yunohost/app.py index 5599c0d53..851fcdaa6 100644 --- a/src/yunohost/app.py +++ b/src/yunohost/app.py @@ -1016,7 +1016,9 @@ def app_makedefault(auth, app, domain=None): if '/' in app_map(raw=True)[domain]: raise MoulinetteError(errno.EEXIST, - m18n.n('app_location_already_used')) + m18n.n('app_make_default_location_already_used', + app=app, domain=app_domain, + other_app=app_map(raw=True)[domain]["/"]["id"])) try: with open('/etc/ssowat/conf.json.persistent') as json_conf: From e8196cbc9855ab460ec9cbcb6c3505e70eb46be1 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Sun, 7 Jan 2018 17:23:02 +0100 Subject: [PATCH 3/3] [doc] add comment to speak intent --- src/yunohost/app.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/yunohost/app.py b/src/yunohost/app.py index 851fcdaa6..d9ca5977f 100644 --- a/src/yunohost/app.py +++ b/src/yunohost/app.py @@ -1173,6 +1173,7 @@ def app_checkurl(auth, url, app=None): raise MoulinetteError(errno.EINVAL, m18n.n('app_location_already_used', app=a["id"], path=path)) + # can't install "/a/b/" if "/a/" exists elif path.startswith(p) or p.startswith(path): raise MoulinetteError(errno.EPERM, m18n.n('app_location_install_failed',