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,8 +352,9 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
def refresh_url(self):
query_parameters = [("limit", 0)]
query_parameters.extend(filter(lambda x: x,
map(self.validate_query_parameters, self.query_filters)))
if self.query_filters:
query_parameters.extend(filter(lambda x: x,
map(self.validate_query_parameters, self.query_filters)))
self.device_url = self.api_endpoint + "/api/dcim/devices/" + "?" + urlencode(query_parameters)
self.virtual_machines_url = "".join([self.api_endpoint,
"/api/virtualization/virtual-machines/",