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

Fixed the ssl-certs in netbox plugin (#46543)

* Fixed the ssl-certs in netbox plugin

* Added validate_certs parameter and updated the example
This commit is contained in:
nikkytub 2018-10-17 22:30:47 +02:00 committed by John R Barker
parent 8a7a819040
commit 539f0fee09

View file

@ -71,6 +71,7 @@ EXAMPLES = '''
plugin: netbox
api_endpoint: http://localhost:8000
validate_certs: True
group_by:
- device_roles
query_filters:
@ -152,7 +153,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
NAME = 'netbox'
def _fetch_information(self, url):
response = open_url(url, headers=self.headers, timeout=self.timeout)
response = open_url(url, headers=self.headers, timeout=self.timeout, validate_certs=self.validate_certs)
try:
raw_data = to_text(response.read(), errors='surrogate_or_strict')
@ -427,6 +428,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
token = self.get_option("token")
self.api_endpoint = self.get_option("api_endpoint")
self.timeout = self.get_option("timeout")
self.validate_certs = self.get_option("validate_certs")
self.headers = {
'Authorization': "Token %s" % token,
'User-Agent': "ansible %s Python %s" % (ansible_version, python_version.split(' ')[0]),