nxos_facts: Don't fail if faninfo isn't reported (#66866)
This commit is contained in:
parent
72e1716f29
commit
bf65e7a3f6
2 changed files with 15 additions and 7 deletions
2
changelogs/fragments/66866_nxos_fan_facts.yaml
Normal file
2
changelogs/fragments/66866_nxos_fan_facts.yaml
Normal file
|
@ -0,0 +1,2 @@
|
|||
bugfixes:
|
||||
- "nxos_facts: Don't throw an error if faninfo is not reported."
|
|
@ -622,13 +622,19 @@ class Legacy(FactsBase):
|
|||
|
||||
def parse_structured_fan_info(self, data):
|
||||
objects = list()
|
||||
if data.get('fandetails'):
|
||||
data = data['fandetails']['TABLE_faninfo']['ROW_faninfo']
|
||||
elif data.get('fandetails_3k'):
|
||||
data = data['fandetails_3k']['TABLE_faninfo']['ROW_faninfo']
|
||||
else:
|
||||
return objects
|
||||
objects = list(self.transform_iterable(data, self.FAN_MAP))
|
||||
|
||||
for key in ("fandetails", "fandetails_3k"):
|
||||
if data.get(key):
|
||||
try:
|
||||
data = data[key]['TABLE_faninfo']['ROW_faninfo']
|
||||
except KeyError:
|
||||
# Some virtual images don't actually report faninfo. In this case, move on and
|
||||
# just return an empty list.
|
||||
pass
|
||||
else:
|
||||
objects = list(self.transform_iterable(data, self.FAN_MAP))
|
||||
break
|
||||
|
||||
return objects
|
||||
|
||||
def parse_structured_power_supply_info(self, data):
|
||||
|
|
Loading…
Reference in a new issue