Fix the iosxr_facts mem gathering (#23850)

We were not calling match.group, plus we were lacking a ':' from
the expected output of 'show memory summary'.

Fixes #23737
(cherry picked from commit d0fd8cefaa)
This commit is contained in:
Ricardo Carrillo Cruz 2017-04-21 10:41:50 +02:00
parent 1ea67950e1
commit 283f7f9e24

View file

@ -174,11 +174,11 @@ class Hardware(FactsBase):
self.facts['filesystems'] = self.parse_filesystems(
results['dir /all'])
match = re.search(r'Physical Memory (\d+)M total \((\d+)',
match = re.search(r'Physical Memory: (\d+)M total \((\d+)',
results['show memory summary'])
if match:
self.facts['memtotal_mb'] = int(match[0])
self.facts['memfree_mb'] = int(match[1])
self.facts['memtotal_mb'] = match.group(1)
self.facts['memfree_mb'] = match.group(2)
def parse_filesystems(self, data):
return re.findall(r'^Directory of (\S+)', data, re.M)