From c7d315c7e0f8d2e441f129f6a0c2529b2c6b1275 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Fri, 1 Jan 2021 17:44:07 +0100 Subject: [PATCH 1/2] [mod] also display app label on remove_domain with apps --- src/yunohost/domain.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/yunohost/domain.py b/src/yunohost/domain.py index 7dc4ee74d..2bd195f53 100644 --- a/src/yunohost/domain.py +++ b/src/yunohost/domain.py @@ -182,7 +182,7 @@ def domain_remove(operation_logger, domain, force=False): """ from yunohost.hook import hook_callback - from yunohost.app import app_ssowatconf + from yunohost.app import app_ssowatconf, app_info from yunohost.utils.ldap import _get_ldap_interface if not force and domain not in domain_list()['domains']: @@ -204,8 +204,9 @@ def domain_remove(operation_logger, domain, force=False): for app in _installed_apps(): settings = _get_app_settings(app) + label = app_info(app)["name"] if settings.get("domain") == domain: - apps_on_that_domain.append("%s (on https://%s%s)" % (app, domain, settings["path"]) if "path" in settings else app) + apps_on_that_domain.append("%s \"%s\" (on https://%s%s)" % (app, label, domain, settings["path"]) if "path" in settings else app) if apps_on_that_domain: raise YunohostError('domain_uninstall_app_first', apps=", ".join(apps_on_that_domain)) From e51a1b670e050c1a1842e44039e8e5fb64adae87 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Fri, 1 Jan 2021 19:13:43 +0100 Subject: [PATCH 2/2] [ux] add command instructions and suggest change-url for domain_uninstall_app_first --- locales/en.json | 2 +- src/yunohost/domain.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/locales/en.json b/locales/en.json index c24fc831c..f8f296a7b 100644 --- a/locales/en.json +++ b/locales/en.json @@ -277,7 +277,7 @@ "domain_dyndns_root_unknown": "Unknown DynDNS root domain", "domain_exists": "The domain already exists", "domain_hostname_failed": "Unable to set new hostname. This might cause an issue later (it might be fine).", - "domain_uninstall_app_first": "Those applications are still installed on your domain: {apps}. Please uninstall them before proceeding to domain removal", + "domain_uninstall_app_first": "Those applications are still installed on your domain:\n{apps}\n\nPlease uninstall them using 'yunohost app remove the_app_id' or move them to another domain using 'yunohost app change-url the_app_id' before proceeding to domain removal", "domain_name_unknown": "Domain '{domain}' unknown", "domain_unknown": "Unknown domain", "domains_available": "Available domains:", diff --git a/src/yunohost/domain.py b/src/yunohost/domain.py index 2bd195f53..d581b8426 100644 --- a/src/yunohost/domain.py +++ b/src/yunohost/domain.py @@ -206,10 +206,10 @@ def domain_remove(operation_logger, domain, force=False): settings = _get_app_settings(app) label = app_info(app)["name"] if settings.get("domain") == domain: - apps_on_that_domain.append("%s \"%s\" (on https://%s%s)" % (app, label, domain, settings["path"]) if "path" in settings else app) + apps_on_that_domain.append(" - %s \"%s\" on https://%s%s" % (app, label, domain, settings["path"]) if "path" in settings else app) if apps_on_that_domain: - raise YunohostError('domain_uninstall_app_first', apps=", ".join(apps_on_that_domain)) + raise YunohostError('domain_uninstall_app_first', apps="\n".join(apps_on_that_domain)) operation_logger.start() ldap = _get_ldap_interface()