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

[PR #5931/f0fd6aa9 backport][stable-6] Suppress urllib3 InsecureRequestWarnings when validate_certs option is false (#5987)

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>
(cherry picked from commit f0fd6aa97d)

Co-authored-by: Boik <qazbnm456@gmail.com>
This commit is contained in:
patchback[bot] 2023-02-13 21:47:26 +01:00 committed by GitHub
parent 8ff611089b
commit 83ff925417
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()