diff --git a/src/yunohost/domain.py b/src/yunohost/domain.py index 9c1563423..1aeab33ef 100644 --- a/src/yunohost/domain.py +++ b/src/yunohost/domain.py @@ -160,7 +160,7 @@ def domain_remove(auth, domain, force=False): raise MoulinetteError(errno.EINVAL, m18n.n('domain_unknown')) # Check domain is not the main domain - if (domain == _get_maindomain()) : + if domain == _get_maindomain(): raise MoulinetteError(errno.EINVAL, m18n.n('domain_cannot_remove_main')) # Check if apps are installed on the domain @@ -290,6 +290,7 @@ def get_public_ip(protocol=4): raise MoulinetteError(errno.ENETUNREACH, m18n.n('no_internet_connection')) + def _get_maindomain(): with open('/etc/yunohost/current_host', 'r') as f: maindomain = f.readline().rstrip() diff --git a/src/yunohost/tools.py b/src/yunohost/tools.py index d8b5f7f7e..2c1c55d77 100644 --- a/src/yunohost/tools.py +++ b/src/yunohost/tools.py @@ -136,7 +136,7 @@ def tools_maindomain(auth, new_domain=None): # If no new domain specified, we return the current main domain if not new_domain: - return { 'current_main_domain': _get_maindomain() } + return {'current_main_domain': _get_maindomain()} # Check domain exists if new_domain not in domain_list(auth)['domains']: @@ -149,7 +149,6 @@ def tools_maindomain(auth, new_domain=None): new_ssl_crt = "/etc/yunohost/certs/%s/crt.pem" % new_domain try: - if os.path.exists(ssl_key) or os.path.lexists(ssl_key) : os.remove(ssl_key) if os.path.exists(ssl_crt) or os.path.lexists(ssl_crt) :