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

Netbox inventory: Fix NoneType issue if query_filters is not in netbox_inventory.yml (#46793)

* Added if state to refresh_url to avoid failure at NoneType when guesry_filters is undefined in netbox_inventory.yml
This commit is contained in:
FragmentedPacket 2018-10-24 09:52:20 -06:00 committed by John R Barker
parent 4219d25fc7
commit f83fa2ac93

View file

@ -352,6 +352,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
def refresh_url(self): def refresh_url(self):
query_parameters = [("limit", 0)] query_parameters = [("limit", 0)]
if self.query_filters:
query_parameters.extend(filter(lambda x: x, query_parameters.extend(filter(lambda x: x,
map(self.validate_query_parameters, self.query_filters))) map(self.validate_query_parameters, self.query_filters)))
self.device_url = self.api_endpoint + "/api/dcim/devices/" + "?" + urlencode(query_parameters) self.device_url = self.api_endpoint + "/api/dcim/devices/" + "?" + urlencode(query_parameters)