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:
parent
10ab164ee6
commit
5ace4fdf97
1 changed files with 6 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue