1
0
Fork 1
mirror of https://github.com/thatmattlove/hyperglass.git synced 2026-01-18 00:48:06 +00:00

fix(plugins): improve type checking for structured output

- Split type checking into two separate conditions for clarity
- Add early return when output contains non-string objects
- Ensure structured output like MikrotikBGPRouteTable passes through unchanged
- Prevent AttributeError on .strip() for tuple containing structured data

Resolves remaining crashes when processing already-structured BGP route data.
This commit is contained in:
Wilhelm Schonfeldt 2025-09-26 12:45:10 +02:00
parent 10ab164ee6
commit 5ace4fdf97

View file

@ -99,13 +99,17 @@ class MikrotikGarbageOutput(OutputPlugin):
"""
# If output is already processed/structured (not raw strings), pass it through unchanged
if not isinstance(output, (tuple, list)) or (output and not isinstance(output[0], str)):
if not isinstance(output, (tuple, list)):
return output
# Check if the tuple/list contains non-string objects (structured data)
if output and not isinstance(output[0], str):
return output
cleaned_outputs = []
for raw_output in output:
# Handle non-string outputs (already processed by other plugins)
# Handle non-string outputs (already processed by other plugins) - double check
if not isinstance(raw_output, str):
cleaned_outputs.append(raw_output)
continue