From b675c8b6187c4b77759e3f96c9c92dd382dabeae Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 28 Nov 2021 10:44:12 +0100 Subject: op-mode: lldp: T3999: bugfix KeyError: 'capability' --- src/op_mode/lldp_op.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/op_mode') diff --git a/src/op_mode/lldp_op.py b/src/op_mode/lldp_op.py index 731e71891..b9ebc991a 100755 --- a/src/op_mode/lldp_op.py +++ b/src/op_mode/lldp_op.py @@ -55,6 +55,9 @@ def parse_data(data, interface): if interface is not None and local_if != interface: continue for chassis, c_value in values.get('chassis', {}).items(): + # bail out early if no capabilities found + if 'capability' not in c_value: + continue capabilities = c_value['capability'] if isinstance(capabilities, dict): capabilities = [capabilities] -- cgit v1.2.3