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

nxos_facts fix NameError (#48981)

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
Trishna Guha 2018-11-27 10:14:13 +05:30 committed by GitHub
parent 12a573a7db
commit 8796085569
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -822,10 +822,16 @@ class Legacy(FactsBase):
def parse_structured_power_supply_info(self, data):
if data.get('powersup').get('TABLE_psinfo_n3k'):
data = data['powersup']['TABLE_psinfo_n3k']['ROW_psinfo_n3k']
fact = data['powersup']['TABLE_psinfo_n3k']['ROW_psinfo_n3k']
else:
data = data['powersup']['TABLE_psinfo']['ROW_psinfo']
objects = list(self.transform_iterable(data, self.POWERSUP_MAP))
if isinstance(data['powersup']['TABLE_psinfo'], list):
fact = []
for i in data['powersup']['TABLE_psinfo']:
fact.append(i['ROW_psinfo'])
else:
fact = data['powersup']['TABLE_psinfo']['ROW_psinfo']
objects = list(self.transform_iterable(fact, self.POWERSUP_MAP))
return objects
def parse_hostname(self, data):