summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorChristian Poessinger <christian.poessinger@rohde-schwarz.com>2020-12-03 07:51:39 +0100
committerChristian Poessinger <christian.poessinger@rohde-schwarz.com>2020-12-03 07:51:39 +0100
commit372ee96d5721bf9b315d1fb9180b553a9f859c4c (patch)
tree889a5767e68b800843601fbeaa4ea67fd2449ada /data
parent66e74557d9434b4b11e7a8a9320790c7319ab864 (diff)
downloadvyos-1x-372ee96d5721bf9b315d1fb9180b553a9f859c4c.tar.gz
vyos-1x-372ee96d5721bf9b315d1fb9180b553a9f859c4c.zip
hostsd: T3105: fix wrong new-line handling after template processor change
Commit c87ad948999 ("vyos.template: T2720: fix remaining in-line time_block syntax") did not take into account when there is an if/endif statement on one line, the following new-line will be discarded.
Diffstat (limited to 'data')
-rw-r--r--data/templates/vyos-hostsd/hosts.tmpl14
1 files changed, 6 insertions, 8 deletions
diff --git a/data/templates/vyos-hostsd/hosts.tmpl b/data/templates/vyos-hostsd/hosts.tmpl
index be8692104..8b73c6e51 100644
--- a/data/templates/vyos-hostsd/hosts.tmpl
+++ b/data/templates/vyos-hostsd/hosts.tmpl
@@ -12,15 +12,13 @@ ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
-{% if hosts %}
+{% if hosts is defined and hosts is not none %}
# From 'system static-host-mapping' and DHCP server
-{% for tag, taghosts in hosts.items() %}
+{% for tag, taghosts in hosts.items() %}
# {{ tag }}
-{% for host, hostprops in taghosts.items() %}
-{% if hostprops['address'] %}
-{{ hostprops['address'] }} {{ host }}{% for a in hostprops['aliases'] %} {{ a }}{% endfor %}
-{% endif %}
-{% endfor %}
-{% endfor %}
+{% for host, hostprops in taghosts.items() if hostprops.address is defined %}
+{{ "%-15s" | format(hostprops.address) }} {{ host }} {{ hostprops.aliases|join(' ') if hostprops.aliases is defined }}
+{% endfor %}
+{% endfor %}
{% endif %}