mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[mod] only check once if the domain exist
This commit is contained in:
parent
a8e57d9c6a
commit
555caa9c73
1 changed files with 3 additions and 6 deletions
|
@ -76,7 +76,9 @@ def domain_add(auth, domain, dyndns=False):
|
|||
|
||||
attr_dict = {'objectClass': ['mailDomain', 'top']}
|
||||
|
||||
if domain in domain_list(auth)['domains']:
|
||||
try:
|
||||
auth.validate_uniqueness({'virtualdomain': domain})
|
||||
except MoulinetteError:
|
||||
raise MoulinetteError(errno.EEXIST, m18n.n('domain_exists'))
|
||||
|
||||
# DynDNS domain
|
||||
|
@ -106,11 +108,6 @@ def domain_add(auth, domain, dyndns=False):
|
|||
try:
|
||||
yunohost.certificate._certificate_install_selfsigned([domain], False)
|
||||
|
||||
try:
|
||||
auth.validate_uniqueness({'virtualdomain': domain})
|
||||
except MoulinetteError:
|
||||
raise MoulinetteError(errno.EEXIST, m18n.n('domain_exists'))
|
||||
|
||||
attr_dict['virtualdomain'] = domain
|
||||
|
||||
if not auth.add('virtualdomain=%s,ou=domains' % domain, attr_dict):
|
||||
|
|
Loading…
Add table
Reference in a new issue