Merge pull request #409 from YunoHost/better_error_ux_app_not_available

Better error ux app not available
This commit is contained in:
Laurent Peuch 2018-01-07 18:45:01 +01:00 committed by GitHub
commit cb29e20b9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View file

@ -18,8 +18,9 @@
"app_id_invalid": "Invalid app id", "app_id_invalid": "Invalid app id",
"app_incompatible": "The app {app} is incompatible with your YunoHost version", "app_incompatible": "The app {app} is incompatible with your YunoHost version",
"app_install_files_invalid": "Invalid installation files", "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_location_install_failed": "Unable to install the app in this location", "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_location_unavailable": "This url is not available or conflicts with an already installed app",
"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 app to upgrade",

View file

@ -1019,7 +1019,9 @@ def app_makedefault(auth, app, domain=None):
if '/' in app_map(raw=True)[domain]: if '/' in app_map(raw=True)[domain]:
raise MoulinetteError(errno.EEXIST, 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: try:
with open('/etc/ssowat/conf.json.persistent') as json_conf: with open('/etc/ssowat/conf.json.persistent') as json_conf:
@ -1172,10 +1174,13 @@ def app_checkurl(auth, url, app=None):
continue continue
if path == p: if path == p:
raise MoulinetteError(errno.EINVAL, raise MoulinetteError(errno.EINVAL,
m18n.n('app_location_already_used')) 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): elif path.startswith(p) or p.startswith(path):
raise MoulinetteError(errno.EPERM, 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: if app is not None and not installed:
app_setting(app, 'domain', value=domain) app_setting(app, 'domain', value=domain)