summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/vyos/opmode.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/python/vyos/opmode.py b/python/vyos/opmode.py
index ac9c0c353..5f9c2c1ce 100644
--- a/python/vyos/opmode.py
+++ b/python/vyos/opmode.py
@@ -185,10 +185,12 @@ def run(module):
# they may return human-formatted output
# or a raw dict that we need to serialize in JSON for printing
res = func(**args)
- res = _normalize_field_names(res)
if not args["raw"]:
return res
else:
+ if not isinstance(res, dict):
+ raise InternalError("'raw' output of 'show_*' command must be a dict")
+ res = _normalize_field_names(res)
from json import dumps
return dumps(res, indent=4)
else: