From 65843bda6dd01ec679c809f8c501d12f06e8e6fd Mon Sep 17 00:00:00 2001 From: axolotle Date: Sun, 24 Sep 2023 18:11:28 +0200 Subject: [PATCH] dyndns: add postinstall recovery password handling --- src/tools.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/tools.py b/src/tools.py index cd48f00ee..2b0b566e2 100644 --- a/src/tools.py +++ b/src/tools.py @@ -157,7 +157,7 @@ def tools_postinstall( overwrite_root_password=True, ): from yunohost.dyndns import _dyndns_available - from yunohost.utils.dns import is_yunohost_dyndns_domain + from yunohost.utils.dns import is_yunohost_dyndns_domain, dyndns_unsubscribe from yunohost.utils.password import ( assert_password_is_strong_enough, assert_password_is_compatible, @@ -218,7 +218,14 @@ def tools_postinstall( ) else: if not available: - raise YunohostValidationError("dyndns_unavailable", domain=domain) + if dyndns_recovery_password: + # Try to unsubscribe the domain so it can be subscribed again + # If successful, it will be resubscribed with the same recovery password + dyndns_unsubscribe( + domain=domain, recovery_password=dyndns_recovery_password + ) + else: + raise YunohostValidationError("dyndns_unavailable", domain=domain) if os.system("iptables -V >/dev/null 2>/dev/null") != 0: raise YunohostValidationError(