From d15092a7401001ffbe8fcceec168bab0657ea439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Mon, 11 Feb 2019 20:22:42 +0100 Subject: [PATCH] Fix result from hook_callback --- src/yunohost/domain.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/yunohost/domain.py b/src/yunohost/domain.py index 088f7724f..66f17c491 100644 --- a/src/yunohost/domain.py +++ b/src/yunohost/domain.py @@ -206,16 +206,16 @@ def domain_dns_conf(domain, ttl=None): result += "; Mail" for record in dns_conf["mail"]: result += "\n{name} {ttl} IN {type} {value}".format(**record) - result += "\n\n + result += "\n\n" result += "; Extra" for record in dns_conf["extra"]: result += "\n{name} {ttl} IN {type} {value}".format(**record) for name, record_list in dns_conf.items(): - if name not in ("basic", "xmpp", "mail"): + if name not in ("basic", "xmpp", "mail", "extra") and record_list: result += "\n\n" - result += "; " + name + "\n" + result += "; " + name for record in record_list: result += "\n{name} {ttl} IN {type} {value}".format(**record) @@ -418,8 +418,10 @@ def _build_dns_conf(domain, ttl=3600): # Custom record hookres = hook_callback('custom_dns_rules', args=[domain]) - for n,v in hookres.items() : - res[n] = v['stdreturn'] + for n, val in hookres.items() : + res[n] = [] + for v in [v['stdreturn'] for p, v in val.items() if v and v['stdreturn']]: + res[n].extend(v) return res