From d18bb080ec6b247646fc407482dff2b198d95b8d Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Thu, 19 Jan 2023 19:26:32 +0000 Subject: T4944: disallow bare literals in raw op mode outputs --- python/vyos/opmode.py | 3 +++ 1 file changed, 3 insertions(+) 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 -- cgit v1.2.3