mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Try to improve the catastrophic error management in domain_add ...
This commit is contained in:
parent
c92e495b21
commit
0616d63222
1 changed files with 5 additions and 6 deletions
|
@ -99,6 +99,7 @@ def domain_add(operation_logger, domain, dyndns=False):
|
||||||
from yunohost.hook import hook_callback
|
from yunohost.hook import hook_callback
|
||||||
from yunohost.app import app_ssowatconf
|
from yunohost.app import app_ssowatconf
|
||||||
from yunohost.utils.ldap import _get_ldap_interface
|
from yunohost.utils.ldap import _get_ldap_interface
|
||||||
|
from yunohost.certificate import _certificate_install_selfsigned
|
||||||
|
|
||||||
if domain.startswith("xmpp-upload."):
|
if domain.startswith("xmpp-upload."):
|
||||||
raise YunohostValidationError("domain_cannot_add_xmpp_upload")
|
raise YunohostValidationError("domain_cannot_add_xmpp_upload")
|
||||||
|
@ -135,11 +136,9 @@ def domain_add(operation_logger, domain, dyndns=False):
|
||||||
# Actually subscribe
|
# Actually subscribe
|
||||||
dyndns_subscribe(domain=domain)
|
dyndns_subscribe(domain=domain)
|
||||||
|
|
||||||
|
_certificate_install_selfsigned([domain], False)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import yunohost.certificate
|
|
||||||
|
|
||||||
yunohost.certificate._certificate_install_selfsigned([domain], False)
|
|
||||||
|
|
||||||
attr_dict = {
|
attr_dict = {
|
||||||
"objectClass": ["mailDomain", "top"],
|
"objectClass": ["mailDomain", "top"],
|
||||||
"virtualdomain": domain,
|
"virtualdomain": domain,
|
||||||
|
@ -166,13 +165,13 @@ def domain_add(operation_logger, domain, dyndns=False):
|
||||||
regen_conf(names=["nginx", "metronome", "dnsmasq", "postfix", "rspamd"])
|
regen_conf(names=["nginx", "metronome", "dnsmasq", "postfix", "rspamd"])
|
||||||
app_ssowatconf()
|
app_ssowatconf()
|
||||||
|
|
||||||
except Exception:
|
except Exception as e:
|
||||||
# Force domain removal silently
|
# Force domain removal silently
|
||||||
try:
|
try:
|
||||||
domain_remove(domain, force=True)
|
domain_remove(domain, force=True)
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
raise
|
raise e
|
||||||
|
|
||||||
hook_callback("post_domain_add", args=[domain])
|
hook_callback("post_domain_add", args=[domain])
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue