summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2023-01-23 10:29:40 -0600
committerGitHub <noreply@github.com>2023-01-23 10:29:40 -0600
commitcf78cac4757ceaca59ace03ad9a6a98f5746f223 (patch)
tree440452c0c7fa2c1d416595c5c266b35079829399 /python
parent1bd69a81dc32fdaa62be27e4f5ae3cfe333f2a26 (diff)
parentd18bb080ec6b247646fc407482dff2b198d95b8d (diff)
downloadvyos-1x-cf78cac4757ceaca59ace03ad9a6a98f5746f223.tar.gz
vyos-1x-cf78cac4757ceaca59ace03ad9a6a98f5746f223.zip
Merge pull request #1770 from dmbaturin/no-bare-literals
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