From 92704e8a93a0c1893d4bdd7680a31e88b2e6f6b6 Mon Sep 17 00:00:00 2001 From: Longxiang Lyu <35479537+lolyu@users.noreply.github.com> Date: Mon, 9 Nov 2020 05:42:38 +0800 Subject: [PATCH] [bgpmon] Fix `dict_keys` unsubscriptable error (#5859) 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 df40d901f3..c20c2110a6 100755 --- a/src/sonic-bgpcfgd/bgpmon/bgpmon.py +++ b/src/sonic-bgpcfgd/bgpmon/bgpmon.py @@ -68,8 +68,8 @@ class BgpStateGet: 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):