From 718d115c994ea67b30589f1e50de1463fd254e79 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 22 Dec 2019 20:11:04 +0100 Subject: lldp: T393: use flat dictionary when generating configs --- src/conf_mode/lldp.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/conf_mode/lldp.py b/src/conf_mode/lldp.py index 62bb6a52e..1b7676274 100755 --- a/src/conf_mode/lldp.py +++ b/src/conf_mode/lldp.py @@ -27,7 +27,7 @@ from vyos import ConfigError config_file = "/etc/default/lldpd" lldp_tmpl = """ ### Autogenerated by lldp.py ### -DAEMON_ARGS="-M4{% if snmp %} -x{% endif %}{% if addr %} -m {{ addr }}{% endif %}{% if cdp %} -c{% endif %}{% if edp %} -e{% endif %}{% if fdp %} -f{% endif %}{% if sonmp %} -s{% endif %}" +DAEMON_ARGS="-M 4{% if options.snmp %} -x{% endif %}{% if options.addr %} -m {{ options.addr }}{% endif %}{% if options.cdp %} -c{% endif %}{% if options.edp %} -e{% endif %}{% if options.fdp %} -f{% endif %}{% if options.sonmp %} -s{% endif %}" """ @@ -36,9 +36,9 @@ vyos_tmpl = """ ### Autogenerated by lldp.py ### configure system platform VyOS -configure system description "VyOS {{ description }}" +configure system description "VyOS {{ options.description }}" {% if listen_on %} -configure system interface pattern "{{ listen_on | join(",") }}" +configure system interface pattern "{{ options.listen_on | join(",") }}" {% endif %} """ @@ -267,13 +267,13 @@ def generate(lldp): # generate /etc/default/lldpd tmpl = jinja2.Template(lldp_tmpl) - config_text = tmpl.render(lldp['options']) + config_text = tmpl.render(lldp) with open(config_file, 'w') as f: f.write(config_text) # generate /etc/lldpd.d/01-vyos.conf tmpl = jinja2.Template(vyos_tmpl) - config_text = tmpl.render(lldp['options']) + config_text = tmpl.render(lldp) with open(vyos_config_file, 'w') as f: f.write(config_text) -- cgit v1.2.3