From b506c7c8a20a1f515c5781fc3c3a11d79e725d15 Mon Sep 17 00:00:00 2001 From: Sebastian Lohff Date: Mon, 15 Jun 2020 03:12:14 +0200 Subject: [PATCH] Python3 fixes for old crawler --- backend/cmk_parser.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/cmk_parser.py b/backend/cmk_parser.py index a28cd13..181302b 100644 --- a/backend/cmk_parser.py +++ b/backend/cmk_parser.py @@ -45,7 +45,7 @@ def parseBGPData(raw, asno): # mkify raw = d.group(2).split("\n") - arr = filter(lambda _z: _z, map(lambda _y: filter(lambda _x: _x, re.split(r"\s+", _y)), raw)) + arr = list(filter(lambda _z: _z, map(lambda _y: list(filter(lambda _x: _x, re.split(r"\s+", _y))), raw))) # parse for bird/quagga result = None @@ -80,7 +80,7 @@ def parseBird(data, raw, asno): status = _birdFindTable(data, "show status") if status[2][0] != "1011-Router": err("Couldn't find router id in bird output") - peers = filter(lambda _x: _x["type"] == "BGP", _birdMakeProtocols(data)) + peers = list(filter(lambda _x: _x["type"] == "BGP", _birdMakeProtocols(data))) if asno == None: err("Host is bird") @@ -135,7 +135,7 @@ def _birdMakeProtocols(info): # state (established, active) # if error, last error is avilable protocols = [] - for proto, data in _birdFindProtocols(info).iteritems(): + for proto, data in _birdFindProtocols(info).items(): protoInfo = { "name": proto, "type": data[0][1], @@ -343,7 +343,7 @@ def _quaggaFindRoutes(raw): d["network"] = lastIP # "parse" path (everything after 61 chars, but no i) - path = filter(lambda _x: _x not in ('', 'i'), line[61:].split(" ")) + path = list(filter(lambda _x: _x not in ('', 'i'), line[61:].split(" "))) # currently skip incomplete routes if '?' not in path: