Browse Source

Python3 fixes for old crawler

Sebastian Lohff 1 year ago
parent
commit
b506c7c8a2
1 changed files with 4 additions and 4 deletions
  1. 4
    4
      backend/cmk_parser.py

+ 4
- 4
backend/cmk_parser.py View File

@@ -45,7 +45,7 @@ def parseBGPData(raw, asno):
45 45
 
46 46
     # mkify
47 47
     raw = d.group(2).split("\n")
48
-    arr = filter(lambda _z: _z, map(lambda _y: filter(lambda _x: _x, re.split(r"\s+", _y)), raw))
48
+    arr = list(filter(lambda _z: _z, map(lambda _y: list(filter(lambda _x: _x, re.split(r"\s+", _y))), raw)))
49 49
 
50 50
     # parse for bird/quagga
51 51
     result = None
@@ -80,7 +80,7 @@ def parseBird(data, raw, asno):
80 80
     status = _birdFindTable(data, "show status")
81 81
     if status[2][0] != "1011-Router":
82 82
         err("Couldn't find router id in bird output")
83
-    peers = filter(lambda _x: _x["type"] == "BGP", _birdMakeProtocols(data))
83
+    peers = list(filter(lambda _x: _x["type"] == "BGP", _birdMakeProtocols(data)))
84 84
 
85 85
     if asno == None:
86 86
         err("Host is bird")
@@ -135,7 +135,7 @@ def _birdMakeProtocols(info):
135 135
     #   state (established, active)
136 136
     #   if error, last error is avilable
137 137
     protocols = []
138
-    for proto, data in _birdFindProtocols(info).iteritems():
138
+    for proto, data in _birdFindProtocols(info).items():
139 139
         protoInfo = {
140 140
             "name": proto,
141 141
             "type": data[0][1],
@@ -343,7 +343,7 @@ def _quaggaFindRoutes(raw):
343 343
                         d["network"] = lastIP
344 344
 
345 345
                     # "parse" path (everything after 61 chars, but no i)
346
-                    path = filter(lambda _x: _x not in ('', 'i'), line[61:].split(" "))
346
+                    path = list(filter(lambda _x: _x not in ('', 'i'), line[61:].split(" ")))
347 347
 
348 348
                     # currently skip incomplete routes
349 349
                     if '?' not in path:

Loading…
Cancel
Save