mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[ux] better error messages when trying to remove the main domain
This commit is contained in:
parent
1584c90700
commit
94ba47d171
2 changed files with 12 additions and 4 deletions
|
@ -154,12 +154,13 @@
|
||||||
"diagnosis_no_apps": "No installed application",
|
"diagnosis_no_apps": "No installed application",
|
||||||
"dpkg_is_broken": "You cannot do this right now because dpkg/APT (the system package managers) seems to be in a broken state… You can try to solve this issue by connecting through SSH and running `sudo dpkg --configure -a`.",
|
"dpkg_is_broken": "You cannot do this right now because dpkg/APT (the system package managers) seems to be in a broken state… You can try to solve this issue by connecting through SSH and running `sudo dpkg --configure -a`.",
|
||||||
"dpkg_lock_not_available": "This command can't be ran right now because another program seems to be using the lock of dpkg (the system package manager)",
|
"dpkg_lock_not_available": "This command can't be ran right now because another program seems to be using the lock of dpkg (the system package manager)",
|
||||||
"domain_cannot_remove_main": "Cannot remove main domain. Set one first",
|
"domain_cannot_remove_main": "You cannot remove '{domain:s}' since it's the main domain, you need first to set another domain as the main domain using 'yunohost domain main-domain -n <another-domain>', here is the list of candidate domains: {other_domains:s}",
|
||||||
|
"domain_cannot_remove_main_add_new_one": "You cannot remove '{domain:s}' since it's the main domain and your only domain, you need to first add another domain using 'yunohost domain add <another-domain.com>', then set is as the main domain using 'yunohost domain main-domain -n <another-domain.com>' and then you can remove the domain '{domain:s}' using 'yunohost domain remove {domain:s}'.'",
|
||||||
"domain_cert_gen_failed": "Could not generate certificate",
|
"domain_cert_gen_failed": "Could not generate certificate",
|
||||||
"domain_created": "Domain created",
|
"domain_created": "Domain created",
|
||||||
"domain_creation_failed": "Could not create domain {domain}: {error}",
|
"domain_creation_failed": "Unable to create domain {domain}: {error}",
|
||||||
"domain_deleted": "Domain deleted",
|
"domain_deleted": "Domain deleted",
|
||||||
"domain_deletion_failed": "Could not delete domain {domain}: {error}",
|
"domain_deletion_failed": "Unable to delete domain {domain}: {error}",
|
||||||
"domain_dns_conf_is_just_a_recommendation": "This command shows you the *recommended* configuration. It does not actually set up the DNS configuration for you. It is your responsability to configure your DNS zone in your registrar according to this recommendation.",
|
"domain_dns_conf_is_just_a_recommendation": "This command shows you the *recommended* configuration. It does not actually set up the DNS configuration for you. It is your responsability to configure your DNS zone in your registrar according to this recommendation.",
|
||||||
"domain_dyndns_already_subscribed": "You have already subscribed to a DynDNS domain",
|
"domain_dyndns_already_subscribed": "You have already subscribed to a DynDNS domain",
|
||||||
"domain_dyndns_root_unknown": "Unknown DynDNS root domain",
|
"domain_dyndns_root_unknown": "Unknown DynDNS root domain",
|
||||||
|
|
|
@ -156,7 +156,14 @@ def domain_remove(operation_logger, domain, force=False):
|
||||||
|
|
||||||
# Check domain is not the main domain
|
# Check domain is not the main domain
|
||||||
if domain == _get_maindomain():
|
if domain == _get_maindomain():
|
||||||
raise YunohostError('domain_cannot_remove_main')
|
other_domains = domain_list()["domains"]
|
||||||
|
other_domains.remove(domain)
|
||||||
|
|
||||||
|
if other_domains:
|
||||||
|
raise YunohostError('domain_cannot_remove_main',
|
||||||
|
domain=domain, other_domains="\n * " + ("\n * ".join(other_domains)))
|
||||||
|
else:
|
||||||
|
raise YunohostError('domain_cannot_remove_main_add_new_one', domain=domain)
|
||||||
|
|
||||||
# Check if apps are installed on the domain
|
# Check if apps are installed on the domain
|
||||||
for app in os.listdir('/etc/yunohost/apps/'):
|
for app in os.listdir('/etc/yunohost/apps/'):
|
||||||
|
|
Loading…
Add table
Reference in a new issue