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

text format fan info mismatch and module info check (#57009)

Signed-off-by: rohitthakur2590 <rohitthakur2590@outlook.com>
This commit is contained in:
Rohit 2019-05-29 19:08:46 +05:30 committed by GitHub
parent a56a9e1eeb
commit b143918f30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -876,7 +876,7 @@ class Legacy(FactsBase):
def parse_module(self, data):
objects = list()
for line in data.splitlines():
if line == '':
if line == '' or re.search(r'\b' + 'Sw' + r'\b', line):
break
if line[0].isdigit():
obj = {}
@ -896,7 +896,7 @@ class Legacy(FactsBase):
if items:
obj['type'] = items[0]
obj['model'] = items[1]
obj['status'] = items[2]
obj['status'] = items[-1]
objects.append(obj)
return objects
@ -910,9 +910,11 @@ class Legacy(FactsBase):
line = l.split()
if len(line) > 1:
obj = {}
if re.search(r'Direction', data, re.M):
obj['direction'] = line[-2]
obj['name'] = line[0]
obj['model'] = line[1]
obj['hw_ver'] = line[-2]
obj['hw_ver'] = line[2]
obj['status'] = line[-1]
objects.append(obj)
return objects