From 882c024bc8cdf2d03b3ccabf08eba76fbd6103f3 Mon Sep 17 00:00:00 2001 From: "theo@manjaro" Date: Fri, 1 Jul 2022 14:16:50 +0200 Subject: [PATCH] `yunohost domain remove` now accepts a -p argument --- share/actionsmap.yml | 5 +++++ src/domain.py | 11 +++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/share/actionsmap.yml b/share/actionsmap.yml index 619b1207d..ea1242825 100644 --- a/share/actionsmap.yml +++ b/share/actionsmap.yml @@ -481,6 +481,11 @@ domain: full: --force help: Do not ask confirmation to remove apps action: store_true + -p: + full: --password + help: Password used to delete the domain from DynDNS + extra: + pattern: *pattern_password ### domain_dns_conf() diff --git a/src/domain.py b/src/domain.py index 2426412c4..a8a9560cb 100644 --- a/src/domain.py +++ b/src/domain.py @@ -235,7 +235,7 @@ def domain_add(operation_logger, domain, dyndns=False,password=None): @is_unit_operation() -def domain_remove(operation_logger, domain, remove_apps=False, force=False): +def domain_remove(operation_logger, domain, remove_apps=False, force=False, password=None): """ Delete domains @@ -244,7 +244,7 @@ def domain_remove(operation_logger, domain, remove_apps=False, force=False): remove_apps -- Remove applications installed on the domain force -- Force the domain removal and don't not ask confirmation to remove apps if remove_apps is specified - + password -- Recovery password used at the creation of the DynDNS domain """ from yunohost.hook import hook_callback from yunohost.app import app_ssowatconf, app_info, app_remove @@ -356,6 +356,13 @@ def domain_remove(operation_logger, domain, remove_apps=False, force=False): hook_callback("post_domain_remove", args=[domain]) + # If a password is provided, delete the DynDNS record + if password: + from yunohost.dyndns import dyndns_unsubscribe + + # Actually unsubscribe + dyndns_unsubscribe(domain=domain,password=password) + logger.success(m18n.n("domain_deleted"))