Skip to content

Commit

Permalink
fix cliconf for IOS XRd #509
Browse files Browse the repository at this point in the history
  • Loading branch information
jmussmann committed Sep 10, 2024
1 parent b16ee29 commit 3b979d9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions plugins/cliconf/iosxr.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@
from ansible.module_utils._text import to_text
from ansible.module_utils.common._collections_compat import Mapping
from ansible.module_utils.connection import ConnectionError
from ansible.plugins.action import display
from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.config import (
NetworkConfig,
dumps,
Expand Down Expand Up @@ -248,13 +249,17 @@ 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)
Expand Down

0 comments on commit 3b979d9

Please sign in to comment.