From 7c7e9eed97cfc2311471e68db697e2f83dcb680c Mon Sep 17 00:00:00 2001 From: jmussmann Date: Tue, 10 Sep 2024 11:50:24 +0200 Subject: [PATCH] fix cliconf for IOS XRd #509 --- plugins/cliconf/iosxr.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/cliconf/iosxr.py b/plugins/cliconf/iosxr.py index 48d08fc8..8ec039d7 100644 --- a/plugins/cliconf/iosxr.py +++ b/plugins/cliconf/iosxr.py @@ -248,13 +248,16 @@ def get_device_info(self): device_info["network_os_model"] = match.group(1) break - if "network_os_model" not in device_info: + try: data = self.get_command_output("show inventory") + except AnsibleConnectionFailure: + data = "" + + if "network_os_model" not in device_info: match = re.search(r"DESCR: \"[Cc]isco (\S+ \S+)", data, re.M) if match: device_info["network_os_model"] = match.group(1) - data = self.get_command_output("show inventory") match = re.search(r"SN: (\S+)\n\nNAME:", data, re.M) if match: device_info["network_os_serialnum"] = match.group(1)