Skip to content

Commit

Permalink
Get custom dns conf in _build_dns_conf
Browse files Browse the repository at this point in the history
  • Loading branch information
Josue-T committed Aug 26, 2018
1 parent 5e984f5 commit 15f494b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/yunohost/domain.py
Expand Up @@ -38,6 +38,7 @@
from yunohost.service import service_regen_conf
from yunohost.utils.network import get_public_ip
from yunohost.log import is_unit_operation
from yunohost.hook import hook_callback

logger = getActionLogger('yunohost.domain')

Expand Down Expand Up @@ -188,7 +189,6 @@ def domain_dns_conf(domain, ttl=None):
ttl -- Time to live
"""
from yunohost.hook import hook_callback

ttl = 3600 if ttl is None else ttl

Expand All @@ -212,8 +212,8 @@ def domain_dns_conf(domain, ttl=None):

result += "\n\n"
result += "; Custom\n"

result += ''.join(hook_callback('custom_dns_rules', args=[])['stdreturn'])
for record in dns_conf["custom"]:
result += "\n{name} {ttl} IN {type} {value}".format(**record)

is_cli = True if msettings.get('interface') == 'cli' else False
if is_cli:
Expand Down Expand Up @@ -393,10 +393,15 @@ def _build_dns_conf(domain, ttl=3600):
["_dmarc", ttl, "TXT", '"v=DMARC1; p=none"'],
]

# Custom
custom = hook_callback('custom_dns_rules', args=[domain])['stdreturn']
print(custom)

return {
"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],
"mail": [{"name": name, "ttl": ttl, "type": type_, "value": value} for name, ttl, type_, value in mail],
"custom": custom,
}


Expand Down

0 comments on commit 15f494b

Please sign in to comment.