Nxos facts fix backport (#57150)
* text format fan info mismatch and module info check (#57009)
Signed-off-by: rohitthakur2590 <rohitthakur2590@outlook.com>
(cherry picked from commit b143918f30
)
* nxos facts fix backport to stable 2.8
Signed-off-by: rohitthakur2590 <rohitthakur2590@outlook.com>
This commit is contained in:
parent
0365d73102
commit
77e50980b5
2 changed files with 7 additions and 3 deletions
2
changelogs/fragments/nxos_facts_fix_backport_fix.yaml
Normal file
2
changelogs/fragments/nxos_facts_fix_backport_fix.yaml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- nxos_facts fix <https://github.com/ansible/ansible/pull/57009>
|
|
@ -881,7 +881,7 @@ class Legacy(FactsBase):
|
||||||
def parse_module(self, data):
|
def parse_module(self, data):
|
||||||
objects = list()
|
objects = list()
|
||||||
for line in data.splitlines():
|
for line in data.splitlines():
|
||||||
if line == '':
|
if line == '' or re.search(r'\b' + 'Sw' + r'\b', line):
|
||||||
break
|
break
|
||||||
if line[0].isdigit():
|
if line[0].isdigit():
|
||||||
obj = {}
|
obj = {}
|
||||||
|
@ -901,7 +901,7 @@ class Legacy(FactsBase):
|
||||||
if items:
|
if items:
|
||||||
obj['type'] = items[0]
|
obj['type'] = items[0]
|
||||||
obj['model'] = items[1]
|
obj['model'] = items[1]
|
||||||
obj['status'] = items[2]
|
obj['status'] = items[-1]
|
||||||
|
|
||||||
objects.append(obj)
|
objects.append(obj)
|
||||||
return objects
|
return objects
|
||||||
|
@ -915,9 +915,11 @@ class Legacy(FactsBase):
|
||||||
line = l.split()
|
line = l.split()
|
||||||
if len(line) > 1:
|
if len(line) > 1:
|
||||||
obj = {}
|
obj = {}
|
||||||
|
if re.search(r'Direction', data, re.M):
|
||||||
|
obj['direction'] = line[-2]
|
||||||
obj['name'] = line[0]
|
obj['name'] = line[0]
|
||||||
obj['model'] = line[1]
|
obj['model'] = line[1]
|
||||||
obj['hw_ver'] = line[-2]
|
obj['hw_ver'] = line[2]
|
||||||
obj['status'] = line[-1]
|
obj['status'] = line[-1]
|
||||||
objects.append(obj)
|
objects.append(obj)
|
||||||
return objects
|
return objects
|
||||||
|
|
Loading…
Reference in a new issue