From 060b4e1d06274a4f8bce6f8ad7bdb02f8a8b5190 Mon Sep 17 00:00:00 2001 From: Cyrus Patel Date: Tue, 17 Feb 2026 15:12:13 -0800 Subject: [PATCH] updating re_show_redundancy to check for null value --- pyntc/devices/ios_device.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pyntc/devices/ios_device.py b/pyntc/devices/ios_device.py index c5c78e22..cecec7fd 100644 --- a/pyntc/devices/ios_device.py +++ b/pyntc/devices/ios_device.py @@ -841,6 +841,8 @@ def peer_redundancy_state(self): log.error("Host %s: Command error for command 'show redundancy'.", self.host) return None re_show_redundancy = RE_SHOW_REDUNDANCY.match(show_redundancy.lstrip()) + if not re_show_redundancy: + return None processor_redundancy_info = re_show_redundancy.group("other") if processor_redundancy_info is not None: re_redundancy_state = RE_REDUNDANCY_STATE.search(processor_redundancy_info) @@ -905,6 +907,8 @@ def redundancy_mode(self): log.error("Host %s: Command error for command 'show redundancy'.", self.host) return "n/a" re_show_redundancy = RE_SHOW_REDUNDANCY.match(show_redundancy.lstrip()) + if not re_show_redundancy: + return None redundancy_info = re_show_redundancy.group("info") re_redundancy_mode = RE_REDUNDANCY_OPERATION_MODE.search(redundancy_info) redundancy_mode = re_redundancy_mode.group(1).lower() @@ -932,6 +936,8 @@ def redundancy_state(self): log.error("Host %s: Command error for command 'show redundancy'.", self.host) return None re_show_redundancy = RE_SHOW_REDUNDANCY.match(show_redundancy.lstrip()) + if not re_show_redundancy: + return None processor_redundancy_info = re_show_redundancy.group("self") re_redundancy_state = RE_REDUNDANCY_STATE.search(processor_redundancy_info) processor_redundancy_state = re_redundancy_state.group(1).lower()