summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-09-16 21:27:02 +0200
committerChristian Poessinger <christian@poessinger.com>2020-09-16 21:54:37 +0200
commitaca23987aaa42bebe8950cf1a36ea3f0e4ee47a9 (patch)
tree8f538a76c34d940ffb18c18fb9b551ac17974807 /src
parent857c4c10248a4f74b9b73d302ed9776cb818ff1b (diff)
downloadvyos-1x-aca23987aaa42bebe8950cf1a36ea3f0e4ee47a9.tar.gz
vyos-1x-aca23987aaa42bebe8950cf1a36ea3f0e4ee47a9.zip
wireless: T2887: Jinja2 can not work on keys starting with a number
... an error would be presented: jinja2.exceptions.TemplateSyntaxError: expected token 'end of statement block', got 'mhz_incapable', thus we simply rename the key before rendering the template.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/interfaces-wireless.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/conf_mode/interfaces-wireless.py b/src/conf_mode/interfaces-wireless.py
index 9861f72db..c6c843e7b 100755
--- a/src/conf_mode/interfaces-wireless.py
+++ b/src/conf_mode/interfaces-wireless.py
@@ -33,6 +33,7 @@ from vyos.configverify import verify_vrf
from vyos.ifconfig import WiFiIf
from vyos.template import render
from vyos.util import call
+from vyos.util import vyos_dict_search
from vyos import ConfigError
from vyos import airbag
airbag.enable()
@@ -213,6 +214,11 @@ def generate(wifi):
mac.dialect = mac_unix_expanded
wifi['mac'] = str(mac)
+ # XXX: Jinja2 can not operate on a dictionary key when it starts of with a number
+ if '40mhz_incapable' in (vyos_dict_search('capabilities.ht', wifi) or []):
+ wifi['capabilities']['ht']['fourtymhz_incapable'] = wifi['capabilities']['ht']['40mhz_incapable']
+ del wifi['capabilities']['ht']['40mhz_incapable']
+
# render appropriate new config files depending on access-point or station mode
if wifi['type'] == 'access-point':
render(hostapd_conf.format(**wifi), 'wifi/hostapd.conf.tmpl', wifi, trim_blocks=True)