[fix] Call regen-conf only once passing a list in domain_add/remove

This commit is contained in:
Jérôme Lebleu 2016-04-24 22:15:29 +02:00
parent 55f4ff8d69
commit 55debefd56

View file

@ -37,6 +37,8 @@ from urllib import urlopen
from moulinette.core import MoulinetteError
from moulinette.utils.log import getActionLogger
from yunohost.service import service_regen_conf
logger = getActionLogger('yunohost.domain')
@ -78,7 +80,6 @@ def domain_add(auth, domain, dyndns=False):
dyndns -- Subscribe to DynDNS
"""
from yunohost.service import service_regen_conf
from yunohost.hook import hook_callback
attr_dict = { 'objectClass' : ['mailDomain', 'top'] }
@ -157,10 +158,8 @@ def domain_add(auth, domain, dyndns=False):
try:
with open('/etc/yunohost/installed', 'r') as f:
service_regen_conf(names='nginx')
service_regen_conf(names='metronome')
service_regen_conf(names='dnsmasq')
service_regen_conf(names='rmilter')
service_regen_conf(names=[
'nginx', 'metronome', 'dnsmasq', 'rmilter'])
os.system('yunohost app ssowatconf > /dev/null 2>&1')
except IOError: pass
except:
@ -183,7 +182,6 @@ def domain_remove(auth, domain, force=False):
force -- Force the domain removal
"""
from yunohost.service import service_regen_conf
from yunohost.hook import hook_callback
if not force and domain not in domain_list(auth)['domains']:
@ -206,9 +204,7 @@ def domain_remove(auth, domain, force=False):
else:
raise MoulinetteError(errno.EIO, m18n.n('domain_deletion_failed'))
service_regen_conf(names='nginx')
service_regen_conf(names='metronome')
service_regen_conf(names='dnsmasq')
service_regen_conf(names=['nginx', 'metronome', 'dnsmasq'])
os.system('yunohost app ssowatconf > /dev/null 2>&1')
hook_callback('post_domain_remove', args=[domain])