domain/dns: don't miserably crash when the domain is known by lexicon but not in registrar_list.toml

This commit is contained in:
Alexandre Aubin 2023-02-06 16:26:01 +01:00
parent 29c6564f09
commit b5b69e952d

View file

@ -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")