[enh] Add hooks for post domain add/remove (fix #108)

This commit is contained in:
Jérôme Lebleu 2015-10-12 21:43:31 +02:00
parent 1beadf3051
commit 3e1d9fc33b

View file

@ -80,6 +80,7 @@ def domain_add(auth, domain, dyndns=False):
"""
from yunohost.service import service_regenconf
from yunohost.hook import hook_callback
attr_dict = { 'objectClass' : ['mailDomain', 'top'] }
try:
@ -172,6 +173,8 @@ def domain_add(auth, domain, dyndns=False):
except: pass
raise
hook_callback('post_domain_add', args=[domain])
msignals.display(m18n.n('domain_created'), 'success')
@ -185,6 +188,7 @@ def domain_remove(auth, domain, force=False):
"""
from yunohost.service import service_regenconf
from yunohost.hook import hook_callback
if not force and domain not in domain_list(auth)['domains']:
raise MoulinetteError(errno.EINVAL, m18n.n('domain_unknown'))
@ -211,4 +215,6 @@ def domain_remove(auth, domain, force=False):
service_regenconf(service='dnsmasq')
os.system('yunohost app ssowatconf > /dev/null 2>&1')
hook_callback('post_domain_remove', args=[domain])
msignals.display(m18n.n('domain_deleted'), 'success')