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

Remove superfluous include on iosxr filesystems fact gathering (#21775)

The regex will catch only lines that start with 'Directory of' regardless.
Also, fixing unit tests while at it.
This commit is contained in:
Ricardo Carrillo Cruz 2017-02-22 15:44:17 +01:00 committed by GitHub
parent 9e6980a039
commit ab4e83f288
4 changed files with 9 additions and 5 deletions

View file

@ -166,11 +166,11 @@ class Default(FactsBase):
class Hardware(FactsBase):
def commands(self):
return(['dir /all | include Directory', 'show memory summary'])
return(['dir /all', 'show memory summary'])
def populate(self, results):
self.facts['filesystems'] = self.parse_filesystems(
results['dir /all | include Directory'])
results['dir /all'])
match = re.search(r'Physical Memory (\d+)M total \((\d+)',
results['show memory summary'])

View file

@ -0,0 +1,6 @@
Directory of disk0:
file1
file2
Directory of flash0:
file3

View file

@ -52,7 +52,6 @@ class TestIosxrFacts(TestIosxrModule):
command = item
filename = str(command).replace(' ', '_')
filename = filename.replace('/', '7')
filename = filename.replace('|', '1')
output.append(load_fixture(filename))
return output
@ -66,7 +65,7 @@ class TestIosxrFacts(TestIosxrModule):
self.assertIn('default', ansible_facts['ansible_net_gather_subset'])
self.assertIn('interfaces', ansible_facts['ansible_net_gather_subset'])
self.assertEquals('iosxr01', ansible_facts['ansible_net_hostname'])
self.assertEquals([], ansible_facts['ansible_net_filesystems'])
self.assertEquals(['disk0:', 'flash0:'], ansible_facts['ansible_net_filesystems'])
self.assertIn('GigabitEthernet0/0/0/0',
ansible_facts['ansible_net_interfaces'].keys())