yunohost domain remove now accepts a -p argument

This commit is contained in:
theo@manjaro 2022-07-01 14:16:50 +02:00
parent 4f2a111470
commit 882c024bc8
2 changed files with 14 additions and 2 deletions

View file

@ -481,6 +481,11 @@ domain:
full: --force full: --force
help: Do not ask confirmation to remove apps help: Do not ask confirmation to remove apps
action: store_true action: store_true
-p:
full: --password
help: Password used to delete the domain from DynDNS
extra:
pattern: *pattern_password
### domain_dns_conf() ### domain_dns_conf()

View file

@ -235,7 +235,7 @@ def domain_add(operation_logger, domain, dyndns=False,password=None):
@is_unit_operation() @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 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 remove_apps -- Remove applications installed on the domain
force -- Force the domain removal and don't not ask confirmation to force -- Force the domain removal and don't not ask confirmation to
remove apps if remove_apps is specified 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.hook import hook_callback
from yunohost.app import app_ssowatconf, app_info, app_remove 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]) 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")) logger.success(m18n.n("domain_deleted"))