1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

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
This commit is contained in:
Ricardo Carrillo Cruz 2017-04-21 10:41:50 +02:00 committed by GitHub
parent 8ec4882ba0
commit d0fd8cefaa

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)