mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[fix] Add domain only if needed on main domain change #19
This commit is contained in:
parent
8f1dd4b5e3
commit
4d2c6bfb64
3 changed files with 8 additions and 3 deletions
|
@ -112,6 +112,7 @@
|
||||||
"password_too_short" : "Password is too short",
|
"password_too_short" : "Password is too short",
|
||||||
"admin_password_change_failed" : "Unable to change password",
|
"admin_password_change_failed" : "Unable to change password",
|
||||||
"admin_password_changed" : "Administration password successfully changed",
|
"admin_password_changed" : "Administration password successfully changed",
|
||||||
|
"new_domain_required" : "You must provide the new main domain",
|
||||||
"maindomain_change_failed" : "Unable to change main domain",
|
"maindomain_change_failed" : "Unable to change main domain",
|
||||||
"maindomain_changed" : "Main domain successfully changed",
|
"maindomain_changed" : "Main domain successfully changed",
|
||||||
"yunohost_installing" : "Installing YunoHost...",
|
"yunohost_installing" : "Installing YunoHost...",
|
||||||
|
|
|
@ -112,6 +112,7 @@
|
||||||
"password_too_short" : "Le mot de passe est trop court",
|
"password_too_short" : "Le mot de passe est trop court",
|
||||||
"admin_password_change_failed" : "Impossible de modifier le mot de passe d'administration",
|
"admin_password_change_failed" : "Impossible de modifier le mot de passe d'administration",
|
||||||
"admin_password_changed" : "Mot de passe d'administration modifié avec succès",
|
"admin_password_changed" : "Mot de passe d'administration modifié avec succès",
|
||||||
|
"new_domain_required" : "Vous devez spécifier le nouveau domaine principal",
|
||||||
"maindomain_change_failed" : "Impossible de modifier le domaine principal",
|
"maindomain_change_failed" : "Impossible de modifier le domaine principal",
|
||||||
"maindomain_changed" : "Domaine principal modifié avec succès",
|
"maindomain_changed" : "Domaine principal modifié avec succès",
|
||||||
"yunohost_installing" : "Installation de YunoHost...",
|
"yunohost_installing" : "Installation de YunoHost...",
|
||||||
|
|
9
tools.py
9
tools.py
|
@ -107,7 +107,7 @@ def tools_maindomain(auth, old_domain=None, new_domain=None, dyndns=False):
|
||||||
old_domain
|
old_domain
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from yunohost.domain import domain_add
|
from yunohost.domain import domain_add, domain_list
|
||||||
from yunohost.dyndns import dyndns_subscribe
|
from yunohost.dyndns import dyndns_subscribe
|
||||||
|
|
||||||
if not old_domain:
|
if not old_domain:
|
||||||
|
@ -117,6 +117,11 @@ def tools_maindomain(auth, old_domain=None, new_domain=None, dyndns=False):
|
||||||
if not new_domain:
|
if not new_domain:
|
||||||
return { 'current_main_domain': old_domain }
|
return { 'current_main_domain': old_domain }
|
||||||
|
|
||||||
|
if not new_domain:
|
||||||
|
raise MoulinetteError(errno.EINVAL, m18n.n('new_domain_required'))
|
||||||
|
if new_domain not in domain_list(auth)['domains']:
|
||||||
|
domain_add(auth, new_domain, main=True)
|
||||||
|
|
||||||
config_files = [
|
config_files = [
|
||||||
'/etc/postfix/main.cf',
|
'/etc/postfix/main.cf',
|
||||||
'/etc/metronome/metronome.cfg.lua',
|
'/etc/metronome/metronome.cfg.lua',
|
||||||
|
@ -140,8 +145,6 @@ def tools_maindomain(auth, old_domain=None, new_domain=None, dyndns=False):
|
||||||
for line in lines:
|
for line in lines:
|
||||||
sources.write(re.sub(r''+ old_domain +'', new_domain, line))
|
sources.write(re.sub(r''+ old_domain +'', new_domain, line))
|
||||||
|
|
||||||
domain_add(auth, new_domain, main=True)
|
|
||||||
|
|
||||||
os.system('rm /etc/ssl/private/yunohost_key.pem')
|
os.system('rm /etc/ssl/private/yunohost_key.pem')
|
||||||
os.system('rm /etc/ssl/certs/yunohost_crt.pem')
|
os.system('rm /etc/ssl/certs/yunohost_crt.pem')
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue