summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2022-10-28 10:27:09 -0500
committerGitHub <noreply@github.com>2022-10-28 10:27:09 -0500
commit5f26d80a262dacbff750a22b670a9b8411773174 (patch)
tree09820fb7f804967eff453d3df73d4a72a2cf933a
parentea8d4ae325059681460f6c74751cfe8ebb2931bc (diff)
parentfca46598415f0c6f11c272d6b384ac98500fd69d (diff)
downloadvyos-1x-5f26d80a262dacbff750a22b670a9b8411773174.tar.gz
vyos-1x-5f26d80a262dacbff750a22b670a9b8411773174.zip
Merge pull request #1625 from dmbaturin/op-mode-normalize-nonstring-fields
T4765: handle non-string fields in the raw op mode output normalizer
-rw-r--r--python/vyos/opmode.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/python/vyos/opmode.py b/python/vyos/opmode.py
index c9827d634..727e118a8 100644
--- a/python/vyos/opmode.py
+++ b/python/vyos/opmode.py
@@ -101,6 +101,10 @@ def _get_arg_type(t):
return t
def _normalize_field_name(name):
+ # Convert the name to string if it is not
+ # (in some cases they may be numbers)
+ name = str(name)
+
# Replace all separators with underscores
name = re.sub(r'(\s|[\(\)\[\]\{\}\-\.\,:\"\'\`])+', '_', name)