diff options
author | Daniil Baturin <daniil@baturin.org> | 2018-05-16 03:00:16 +0200 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2018-05-16 03:00:16 +0200 |
commit | 2a477e6bfc80cf7994ad0873b80ca36cab06a456 (patch) | |
tree | 8e596a342032954d598bb46995ed0e25afafc7b2 /src/conf-mode/vyos-config-dns-forwarding.py | |
parent | 1c45baa4465111c8268568c80a2433ee7407fccb (diff) | |
parent | a5e81355d1b81d66fafa99fda7f8efde526250bd (diff) | |
download | vyos-1x-2a477e6bfc80cf7994ad0873b80ca36cab06a456.tar.gz vyos-1x-2a477e6bfc80cf7994ad0873b80ca36cab06a456.zip |
Merge branch 'current' of github.com:vyos/vyos-1x into current
Diffstat (limited to 'src/conf-mode/vyos-config-dns-forwarding.py')
-rwxr-xr-x | src/conf-mode/vyos-config-dns-forwarding.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/conf-mode/vyos-config-dns-forwarding.py b/src/conf-mode/vyos-config-dns-forwarding.py index 0d265f819..be48cde60 100755 --- a/src/conf-mode/vyos-config-dns-forwarding.py +++ b/src/conf-mode/vyos-config-dns-forwarding.py @@ -31,7 +31,6 @@ config_file = r'/etc/powerdns/recursor.conf' # especially in the semicolon-separated lists of name servers. # Please be careful if you edit the template. config_tmpl = """ - ### Autogenerated by vyos-config-dns-forwarding.py ### # Non-configurable defaults @@ -47,19 +46,20 @@ max-cache-entries={{ cache_size }} export-etc-hosts={{ export_hosts_file }} # listen-on -local-address= {{ listen_on | join(',') }} +local-address={{ listen_on | join(',') }} # domain ... server ... {% if domains -%} -{% for d in domains -%} -forward-zones = {{ d.name }} = {{ d.servers | join(";") }} -{% endfor -%} +forward-zones={% for d in domains %} +{{ d.name }}={{ d.servers | join(";") }} +{%- if loop.first %}, {% endif %} +{% endfor %} {% endif %} # name-server -forward-zones-recurse=.= {{ name_servers | join(';') }} +forward-zones-recurse=.={{ name_servers | join(';') }} """ @@ -113,7 +113,7 @@ def get_config(): if conf.exists('name-server'): name_servers = conf.return_values('name-server') - dns.setdefault('name_servers', name_servers) + dns['name_servers'] = dns['name_servers'] + name_servers if conf.exists('system'): conf.set_level('system') @@ -185,7 +185,7 @@ def generate(dns): if dns is None: return None - tmpl = jinja2.Template(config_tmpl) + tmpl = jinja2.Template(config_tmpl, trim_blocks=True) config_text = tmpl.render(dns) with open(config_file, 'w') as f: |