From e2c9a8bbce04d455fc369baceb21512072518011 Mon Sep 17 00:00:00 2001 From: Longxiang Lyu Date: Sun, 8 Nov 2020 05:24:30 +0000 Subject: [PATCH] [bgpmon] Fix `dict_keys` unsubscriptable error Simply looping through `dict_key` object instead of index-subscribing to fix this. Signed-off-by: Longxiang Lyu --- src/sonic-bgpcfgd/bgpmon/bgpmon.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-bgpcfgd/bgpmon/bgpmon.py b/src/sonic-bgpcfgd/bgpmon/bgpmon.py index df40d901f3dd..c20c2110a6b2 100755 --- a/src/sonic-bgpcfgd/bgpmon/bgpmon.py +++ b/src/sonic-bgpcfgd/bgpmon/bgpmon.py @@ -68,8 +68,8 @@ def bgp_activity_detected(self): def update_new_peer_states(self, peer_dict): peer_l = peer_dict["peers"].keys() self.new_peer_l.extend(peer_l) - for i in range (0, len(peer_l)): - self.new_peer_state[peer_l[i]] = peer_dict["peers"][peer_l[i]]["state"] + for peer in peer_l: + self.new_peer_state[peer] = peer_dict["peers"][peer]["state"] # Get a new snapshot of BGP neighbors and store them in the "new" location def get_all_neigh_states(self):