mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Improve naming / semantic / add comments
This commit is contained in:
parent
1c5cec862f
commit
dd87b9192a
1 changed files with 25 additions and 8 deletions
|
@ -408,21 +408,38 @@ def _build_dns_conf(domain, ttl=3600):
|
||||||
]
|
]
|
||||||
|
|
||||||
# Official record
|
# Official record
|
||||||
res = {
|
records = {
|
||||||
"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],
|
||||||
"extra": [{"name": name, "ttl": ttl, "type": type_, "value": value} for name, ttl, type_, value in extra],
|
"extra": [{"name": name, "ttl": ttl, "type": type_, "value": value} for name, ttl, type_, value in extra],
|
||||||
}
|
}
|
||||||
|
|
||||||
# Custom record
|
# Custom records
|
||||||
hookres = hook_callback('custom_dns_rules', args=[domain])
|
hook_results = hook_callback('custom_dns_rules', args=[domain])
|
||||||
for n, val in hookres.items() :
|
for hook_name, results in hook_results.items():
|
||||||
res[n] = []
|
#
|
||||||
for v in [v['stdreturn'] for p, v in val.items() if v and v['stdreturn']]:
|
# There can be multiple results per hook name, so results look like
|
||||||
res[n].extend(v)
|
# {'/some/path/to/hook1':
|
||||||
|
# { 'state': 'succeed',
|
||||||
|
# 'stdreturn': [{'type': 'SRV',
|
||||||
|
# 'name': 'stuff.foo.bar.',
|
||||||
|
# 'value': 'yoloswag',
|
||||||
|
# 'ttl': 3600}]
|
||||||
|
# },
|
||||||
|
# '/some/path/to/hook2':
|
||||||
|
# { ... },
|
||||||
|
# [...]
|
||||||
|
#
|
||||||
|
# Loop over the sub-results
|
||||||
|
custom_records = [v['stdreturn'] for v in results.values()
|
||||||
|
if v and v['stdreturn']]
|
||||||
|
|
||||||
return res
|
records[hook_name] = []
|
||||||
|
for record_list in custom_records:
|
||||||
|
records[hook_name].extend(record_list)
|
||||||
|
|
||||||
|
return records
|
||||||
|
|
||||||
|
|
||||||
def _get_DKIM(domain):
|
def _get_DKIM(domain):
|
||||||
|
|
Loading…
Add table
Reference in a new issue