diff --git a/locales/en.json b/locales/en.json index 07a46b8df..c4413380a 100644 --- a/locales/en.json +++ b/locales/en.json @@ -318,7 +318,8 @@ "domain_remove_confirm_apps_removal": "Removing this domain will remove those applications:\n{apps}\n\nAre you sure you want to do that? [{answers}]", "domain_uninstall_app_first": "Those applications are still installed on your domain:\n{apps}\n\nPlease uninstall them using 'yunohost app remove the_app_id' or move them to another domain using 'yunohost app change-url the_app_id' before proceeding to domain removal", "domain_registrar_is_not_configured": "The registrar is not yet configured for domain {domain}.", - "domain_dns_push_not_applicable": "The DNS push feature is not applicable to domain {domain}", + "domain_dns_push_not_applicable": "The DNS push feature is not applicable to domain {domain}. You should manually configure your DNS records following the documentation at https://yunohost.org/dns_config.", + "domain_dns_push_managed_in_parent_domain": "The DNS push feature is managed in the parent domain {parent_domain}.", "domain_dns_push_failed_to_authenticate": "Failed to authenticate on registrar's API. Most probably the credentials are incorrect? (Error: {error})", "domain_config_mail_in": "Incoming emails", "domain_config_mail_out": "Outgoing emails", diff --git a/src/yunohost/dns.py b/src/yunohost/dns.py index a006a19a2..98933ba75 100644 --- a/src/yunohost/dns.py +++ b/src/yunohost/dns.py @@ -470,11 +470,17 @@ def _get_registrar_config_section(domain): # If parent domain exists in yunohost parent_domain = domain.split(".", 1)[1] if parent_domain in domain_list()["domains"]: + + if Moulinette.interface.type = "api": + parent_domain_link = "[{parent_domain}](#/domains/{parent_domain}/config)" + else: + parent_domain_link = parent_domain + registrar_infos["registrar"] = OrderedDict({ "type": "alert", "style": "info", - "ask": f"This domain is a subdomain of {parent_domain}. DNS registrar configuration should be managed in {parent_domain}'s configuration panel.", # FIXME: i18n - "value": None + "ask": f"This domain is a subdomain of {parent_domain_link}. DNS registrar configuration should be managed in {parent_domain}'s configuration panel.", # FIXME: i18n + "value": "parent_domain" }) return OrderedDict(registrar_infos) @@ -544,6 +550,9 @@ def domain_dns_push(operation_logger, domain, dry_run=False, force=False, purge= if not registrar or registrar in ["None", "yunohost"]: raise YunohostValidationError("domain_dns_push_not_applicable", domain=domain) + if registrar == "parent_domain": + raise YunohostValidationError("domain_dns_push_managed_in_parent_domain", domain=domain, parent_domain=registrar) + base_dns_zone = _get_dns_zone_for_domain(domain) registrar_credentials = settings