From b5b188f9a9d1642d379c32c2364fd89cb367e9c5 Mon Sep 17 00:00:00 2001 From: xuliping Date: Fri, 19 Jan 2024 03:28:57 +0000 Subject: [PATCH] ignroe if output is empty Signed-off-by: xuliping --- src/sonic-bgpcfgd/bgpmon/bgpmon.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sonic-bgpcfgd/bgpmon/bgpmon.py b/src/sonic-bgpcfgd/bgpmon/bgpmon.py index d93829ac1cba..26a5b245413e 100755 --- a/src/sonic-bgpcfgd/bgpmon/bgpmon.py +++ b/src/sonic-bgpcfgd/bgpmon/bgpmon.py @@ -86,6 +86,9 @@ def get_all_neigh_states(self): if rc: syslog.syslog(syslog.LOG_ERR, "*ERROR* Failed with rc:{} when execute: {}".format(rc, cmd)) return + if len(output) == 0: + syslog.syslog(syslog.LOG_WARNING, "*WARNING* output none when execute: {}".format(cmd)) + return peer_info = json.loads(output) # cmd ran successfully, safe to Clean the "new" set/dict for new snapshot