mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Dns hook : add specific comment for each hook
This commit is contained in:
parent
5a27e314ff
commit
f83e9cae7d
1 changed files with 12 additions and 12 deletions
|
@ -210,10 +210,12 @@ def domain_dns_conf(domain, ttl=None):
|
||||||
for record in dns_conf["mail"]:
|
for record in dns_conf["mail"]:
|
||||||
result += "\n{name} {ttl} IN {type} {value}".format(**record)
|
result += "\n{name} {ttl} IN {type} {value}".format(**record)
|
||||||
|
|
||||||
result += "\n\n"
|
for name, record_list in dns_conf.items():
|
||||||
result += "; Custom\n"
|
if name not in ("basic", "xmpp", "mail"):
|
||||||
for record in dns_conf["custom"]:
|
result += "\n\n"
|
||||||
result += "\n{name} {ttl} IN {type} {value}".format(**record)
|
result += "; " + name + "\n"
|
||||||
|
for record in record_list:
|
||||||
|
result += "\n{name} {ttl} IN {type} {value}".format(**record)
|
||||||
|
|
||||||
is_cli = True if msettings.get('interface') == 'cli' else False
|
is_cli = True if msettings.get('interface') == 'cli' else False
|
||||||
if is_cli:
|
if is_cli:
|
||||||
|
@ -393,20 +395,18 @@ def _build_dns_conf(domain, ttl=3600):
|
||||||
["_dmarc", ttl, "TXT", '"v=DMARC1; p=none"'],
|
["_dmarc", ttl, "TXT", '"v=DMARC1; p=none"'],
|
||||||
]
|
]
|
||||||
|
|
||||||
# Custom
|
# Official record
|
||||||
hookres = hook_callback('custom_dns_rules', args=[domain])
|
|
||||||
print(hookres)
|
|
||||||
custom = []
|
|
||||||
for h in hookres.values() :
|
|
||||||
custom.extend(h['stdreturn'])
|
|
||||||
|
|
||||||
res = {
|
res = {
|
||||||
"basic": [{"name": name, "ttl": ttl, "type": type_, "value": value} for name, ttl, type_, value in basic],
|
"basic": [{"name": name, "ttl": ttl, "type": type_, "value": value} for name, ttl, type_, value in basic],
|
||||||
"xmpp": [{"name": name, "ttl": ttl, "type": type_, "value": value} for name, ttl, type_, value in xmpp],
|
"xmpp": [{"name": name, "ttl": ttl, "type": type_, "value": value} for name, ttl, type_, value in xmpp],
|
||||||
"mail": [{"name": name, "ttl": ttl, "type": type_, "value": value} for name, ttl, type_, value in mail],
|
"mail": [{"name": name, "ttl": ttl, "type": type_, "value": value} for name, ttl, type_, value in mail],
|
||||||
"custom": custom,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Custom record
|
||||||
|
hookres = hook_callback('custom_dns_rules', args=[domain])
|
||||||
|
for n,v in hookres.items() :
|
||||||
|
res[n] = v['stdreturn']
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue