mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Merge pull request #978 from YunoHost/app-without-domain
[fix] domain remove if an app without a domain is installed
This commit is contained in:
commit
9e096f7825
2 changed files with 10 additions and 4 deletions
|
@ -271,7 +271,7 @@
|
|||
"domain_dyndns_root_unknown": "Unknown DynDNS root domain",
|
||||
"domain_exists": "The domain already exists",
|
||||
"domain_hostname_failed": "Could not set new hostname. This might cause an issue later (it might be fine).",
|
||||
"domain_uninstall_app_first": "One or more apps are installed on this domain. Please uninstall them before proceeding to domain removal",
|
||||
"domain_uninstall_app_first": "Those applications are still installed on your domain: {apps}. Please uninstall them before proceeding to domain removal",
|
||||
"domain_unknown": "Unknown domain",
|
||||
"domains_available": "Available domains:",
|
||||
"done": "Done",
|
||||
|
|
|
@ -179,9 +179,15 @@ def domain_remove(operation_logger, domain, force=False):
|
|||
raise YunohostError('domain_cannot_remove_main_add_new_one', domain=domain)
|
||||
|
||||
# Check if apps are installed on the domain
|
||||
app_settings = [_get_app_settings(app) for app in _installed_apps()]
|
||||
if any(s["domain"] == domain for s in app_settings):
|
||||
raise YunohostError('domain_uninstall_app_first')
|
||||
apps_on_that_domain = []
|
||||
|
||||
for app in _installed_apps():
|
||||
settings = _get_app_settings(app)
|
||||
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)
|
||||
|
||||
if apps_on_that_domain:
|
||||
raise YunohostError('domain_uninstall_app_first', apps=", ".join(apps_on_that_domain))
|
||||
|
||||
operation_logger.start()
|
||||
ldap = _get_ldap_interface()
|
||||
|
|
Loading…
Add table
Reference in a new issue