Update nsot.py (#19421)
To make this compatible with NSoT v1.x, removing ['data']['devices'].
This commit is contained in:
parent
cbfe15a315
commit
e246bd10ac
1 changed files with 2 additions and 2 deletions
|
@ -216,7 +216,7 @@ class NSoTInventory(object):
|
||||||
Depending on number of devices in NSoT, could be rather slow since this
|
Depending on number of devices in NSoT, could be rather slow since this
|
||||||
has to request every device resource to filter through
|
has to request every device resource to filter through
|
||||||
'''
|
'''
|
||||||
device = [i for i in self.client.devices.get()['data']['devices']
|
device = [i for i in self.client.devices.get()
|
||||||
if host in i['hostname']][0]
|
if host in i['hostname']][0]
|
||||||
attributes = device['attributes']
|
attributes = device['attributes']
|
||||||
attributes.update({'site_id': device['site_id'], 'id': device['id']})
|
attributes.update({'site_id': device['site_id'], 'id': device['id']})
|
||||||
|
@ -277,7 +277,7 @@ class NSoTInventory(object):
|
||||||
|
|
||||||
# Would do a list comprehension here, but would like to save code/time
|
# Would do a list comprehension here, but would like to save code/time
|
||||||
# and also acquire attributes in this step
|
# and also acquire attributes in this step
|
||||||
for host in devices['data']['devices']:
|
for host in devices:
|
||||||
# Iterate through each device that matches query, assign hostname
|
# Iterate through each device that matches query, assign hostname
|
||||||
# to the group's hosts array and then use this single iteration as
|
# to the group's hosts array and then use this single iteration as
|
||||||
# a chance to update self._meta which will be used in the final
|
# a chance to update self._meta which will be used in the final
|
||||||
|
|
Loading…
Reference in a new issue