From 4f2a111470219c04596b123e4731dba874bb7b8f Mon Sep 17 00:00:00 2001 From: "theo@manjaro" Date: Fri, 1 Jul 2022 10:38:25 +0200 Subject: [PATCH] We can now specify a password using the yunohost domain add command --- locales/en.json | 1 + share/actionsmap.yml | 6 ++++++ src/domain.py | 8 +++++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/locales/en.json b/locales/en.json index 0bbd41387..60243b6bd 100644 --- a/locales/en.json +++ b/locales/en.json @@ -338,6 +338,7 @@ "domain_dns_registrar_yunohost": "This domain is a nohost.me / nohost.st / ynh.fr and its DNS configuration is therefore automatically handled by YunoHost without any further configuration. (see the 'yunohost dyndns update' command)", "domain_dyndns_already_subscribed": "You have already subscribed to a DynDNS domain", "domain_dyndns_root_unknown": "Unknown DynDNS root domain", + "domain_password_no_dyndns": "The password is only used for subscribing to (and maybe later unsubscribing from) the DynDNS service", "domain_exists": "The domain already exists", "domain_hostname_failed": "Unable to set new hostname. This might cause an issue later (it might be fine).", "domain_registrar_is_not_configured": "The registrar is not yet configured for domain {domain}.", diff --git a/share/actionsmap.yml b/share/actionsmap.yml index cfc1d6151..619b1207d 100644 --- a/share/actionsmap.yml +++ b/share/actionsmap.yml @@ -457,6 +457,12 @@ domain: full: --dyndns help: Subscribe to the DynDNS service action: store_true + -p: + full: --password + help: Password used to later delete the domain ( if subscribing to the DynDNS service ) + extra: + pattern: *pattern_password + comment: dyndns_added_password ### domain_remove() remove: diff --git a/src/domain.py b/src/domain.py index e40b4f03c..2426412c4 100644 --- a/src/domain.py +++ b/src/domain.py @@ -131,14 +131,14 @@ def _get_parent_domain_of(domain): @is_unit_operation() -def domain_add(operation_logger, domain, dyndns=False): +def domain_add(operation_logger, domain, dyndns=False,password=None): """ Create a custom domain Keyword argument: domain -- Domain name to add dyndns -- Subscribe to DynDNS - + password -- Password used to later unsubscribe from DynDNS """ from yunohost.hook import hook_callback from yunohost.app import app_ssowatconf @@ -183,7 +183,9 @@ def domain_add(operation_logger, domain, dyndns=False): from yunohost.dyndns import dyndns_subscribe # Actually subscribe - dyndns_subscribe(domain=domain) + dyndns_subscribe(domain=domain,password=password) + elif password: # If a password is provided, while not subscribing to a DynDNS service + logger.warning(m18n.n("domain_password_no_dyndns")) _certificate_install_selfsigned([domain], True)