From: Rafael Zalamena Date: Thu, 13 Jul 2017 11:43:32 +0000 (-0300) Subject: topogen: handle JSON decode failures X-Git-Tag: frr-7.1-dev~151^2~277 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=7b093d84e008789ba03448d966e3d706c3500e34;p=mirror%2Ffrr.git topogen: handle JSON decode failures Instead of raise()ing, return a empty dictionary. --- diff --git a/tests/topotests/lib/topogen.py b/tests/topotests/lib/topogen.py index 758ebcf2bf..ad8dd813c2 100644 --- a/tests/topotests/lib/topogen.py +++ b/tests/topotests/lib/topogen.py @@ -645,7 +645,11 @@ class TopoRouter(TopoGear): if isjson is False: return output - return json.loads(output) + try: + return json.loads(output) + except ValueError: + logger.warning('vtysh_cmd: failed to convert json output') + return {} def vtysh_multicmd(self, commands, pretty_output=True): """