mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
dyndns/domain_remove: be paranoid and keep the dyndns unsubscribe + cert/dyndns/setting cleanup before the regenconf
This commit is contained in:
parent
125af4670f
commit
0f109db6ca
1 changed files with 15 additions and 15 deletions
|
@ -428,6 +428,21 @@ def domain_remove(
|
|||
global domain_list_cache
|
||||
domain_list_cache = []
|
||||
|
||||
# If a password is provided, delete the DynDNS record
|
||||
if dyndns:
|
||||
try:
|
||||
# Actually unsubscribe
|
||||
domain_dyndns_unsubscribe(
|
||||
domain=domain, recovery_password=dyndns_recovery_password
|
||||
)
|
||||
except Exception as e:
|
||||
logger.warning(str(e))
|
||||
|
||||
rm(f"/etc/yunohost/certs/{domain}", force=True, recursive=True)
|
||||
for key_file in glob.glob(f"/etc/yunohost/dyndns/K{domain}.+*"):
|
||||
rm(key_file, force=True)
|
||||
rm(f"{DOMAIN_SETTINGS_DIR}/{domain}.yml", force=True)
|
||||
|
||||
# Sometime we have weird issues with the regenconf where some files
|
||||
# appears as manually modified even though they weren't touched ...
|
||||
# There are a few ideas why this happens (like backup/restore nginx
|
||||
|
@ -454,21 +469,6 @@ def domain_remove(
|
|||
|
||||
hook_callback("post_domain_remove", args=[domain])
|
||||
|
||||
# If a password is provided, delete the DynDNS record
|
||||
if dyndns:
|
||||
try:
|
||||
# Actually unsubscribe
|
||||
domain_dyndns_unsubscribe(
|
||||
domain=domain, recovery_password=dyndns_recovery_password
|
||||
)
|
||||
except Exception as e:
|
||||
logger.warning(str(e))
|
||||
|
||||
rm(f"/etc/yunohost/certs/{domain}", force=True, recursive=True)
|
||||
for key_file in glob.glob(f"/etc/yunohost/dyndns/K{domain}.+*"):
|
||||
rm(key_file, force=True)
|
||||
rm(f"{DOMAIN_SETTINGS_DIR}/{domain}.yml", force=True)
|
||||
|
||||
logger.success(m18n.n("domain_deleted"))
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue