From 2fea65579b03c10d8b248e6b7f11ae8ba23bcc59 Mon Sep 17 00:00:00 2001 From: Sebastian Lohff Date: Thu, 13 Aug 2015 12:30:47 +0200 Subject: [PATCH] Better bird parsing --- bin/routerparsers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/routerparsers.py b/bin/routerparsers.py index 99ccbc8..9f3dbe7 100644 --- a/bin/routerparsers.py +++ b/bin/routerparsers.py @@ -154,8 +154,8 @@ def _birdMakeProtocols(info): "online": data[n][2] == "Established", "neighbor_address": data[n+1][2], "neighbor_as": int(data[n+2][2]), - "neighbor_id": data[n+3][2] if data[n+3][0:2] == ["Neighbor", "ID:"] else None, - "last_error": " ".join(data[n+3][2:]) if data[n+3][0:2] == ["Last", "error:"] else None, + "neighbor_id": data[n+3][2] if len(data) > n+3 and data[n+3][0:2] == ["Neighbor", "ID:"] else None, + "last_error": " ".join(data[n+3][2:]) if len(data) > n+3 and data[n+3][0:2] == ["Last", "error:"] else None, } if not found: