summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2023-01-19 19:26:32 +0000
committerDaniil Baturin <daniil@baturin.org>2023-01-19 19:26:32 +0000
commitd18bb080ec6b247646fc407482dff2b198d95b8d (patch)
treeba8efc2c2a8e867c83579f150a858f6d25801745 /python
parent08949c6e85c6fe02bd702894748b41d600ee7d01 (diff)
downloadvyos-1x-d18bb080ec6b247646fc407482dff2b198d95b8d.tar.gz
vyos-1x-d18bb080ec6b247646fc407482dff2b198d95b8d.zip
T4944: disallow bare literals in raw op mode outputs
Diffstat (limited to 'python')
-rw-r--r--python/vyos/opmode.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/python/vyos/opmode.py b/python/vyos/opmode.py
index 30e893d74..3f1053b40 100644
--- a/python/vyos/opmode.py
+++ b/python/vyos/opmode.py
@@ -217,6 +217,9 @@ def run(module):
if not args["raw"]:
return res
else:
+ if not isinstance(res, dict) and not isinstance(res, list):
+ raise InternalError(f"Bare literal is not an acceptable raw output, must be a list or an object.\
+ The output was:{res}")
res = decamelize(res)
res = _normalize_field_names(res)
from json import dumps