proxmox inventory: fix urllib3 InsecureRequestWarnings not suppressing when a token is used (#9099)

* proxmox inventory: fix urllib3 InsecureRequestWarnings not suppressing when a token is used

* proxmox inventory: add changelog fragment

* proxmox inventory: add forgotten pr number

* Update changelog.

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
pull/9102/head
Mikhail Vorontsov 2024-11-04 21:02:34 +03:00 committed by GitHub
parent 94e3635c0a
commit 886d4a6596
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View File

@ -0,0 +1,2 @@
minor_changes:
- proxmox inventory plugin - fix urllib3 ``InsecureRequestWarnings`` not being suppressed when a token is used (https://github.com/ansible-collections/community.general/pull/9099).

View File

@ -276,16 +276,18 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
def _get_auth(self):
validate_certs = self.get_option('validate_certs')
if validate_certs is False:
from requests.packages.urllib3 import disable_warnings
disable_warnings()
if self.proxmox_password:
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()