From b5b69e952d70f0209b0e0579d0ad244a6bb19a1c Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 6 Feb 2023 16:26:01 +0100 Subject: [PATCH] domain/dns: don't miserably crash when the domain is known by lexicon but not in registrar_list.toml --- src/dns.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dns.py b/src/dns.py index d4c9b1380..eb0812c97 100644 --- a/src/dns.py +++ b/src/dns.py @@ -591,7 +591,10 @@ def _get_registrar_config_section(domain): # TODO : add a help tip with the link to the registar's API doc (c.f. Lexicon's README) registrar_list = read_toml(DOMAIN_REGISTRAR_LIST_PATH) - registrar_credentials = registrar_list[registrar] + registrar_credentials = registrar_list.get(registrar) + if registrar_credentials is None: + logger.warning(f"Registrar {registrar} unknown / Should be added to YunoHost's registrar_list.toml by the development team!") + registrar_credentials = {} for credential, infos in registrar_credentials.items(): infos["default"] = infos.get("default", "") infos["optional"] = infos.get("optional", "False")