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

Suppress urllib3 InsecureRequestWarnings when validate_certs option is false (#5931)

* Suppress urllib3 InsecureRequestWarnings when validate_certs option is false

Suppress urllib3 InsecureRequestWarnings when `validate_certs` option is false.

It's clear that the user would know the possible risk when he or she chose to turn off the option, so the warning message could be ignored and make the output clean.

* Create 5915-suppress-urllib3-insecure-request-warnings.yml

* Update changelogs/fragments/5915-suppress-urllib3-insecure-request-warnings.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Remove extra whitespaces

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Boik 2023-02-14 04:36:09 +08:00 committed by GitHub
parent 68d0cac310
commit f0fd6aa97d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- proxmox - suppress urllib3 ``InsecureRequestWarnings`` when ``validate_certs`` option is ``false`` (https://github.com/ansible-collections/community.general/pull/5931).

View file

@ -277,6 +277,11 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
credentials = urlencode({'username': self.proxmox_user, 'password': self.proxmox_password, })
a = self._get_session()
if a.verify is False:
from requests.packages.urllib3 import disable_warnings
disable_warnings()
ret = a.post('%s/api2/json/access/ticket' % self.proxmox_url, data=credentials)
json = ret.json()