summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-12-22 20:11:04 +0100
committerChristian Poessinger <christian@poessinger.com>2019-12-22 20:11:04 +0100
commit718d115c994ea67b30589f1e50de1463fd254e79 (patch)
tree9b3b366bfb80c50d470054384d91ce7f95dc5d62 /src
parent6aca7f73449ea79d4899ca34f0ae17e9c6aaeaab (diff)
downloadvyos-1x-718d115c994ea67b30589f1e50de1463fd254e79.tar.gz
vyos-1x-718d115c994ea67b30589f1e50de1463fd254e79.zip
lldp: T393: use flat dictionary when generating configs
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/lldp.py10
1 files 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)