[PR #9099/886d4a65 backport][stable-9] proxmox inventory: fix urllib3 InsecureRequestWarnings not suppressing when a token is used (#9100)

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

Co-authored-by: Mikhail Vorontsov <52924343+mephs@users.noreply.github.com>
pull/9110/head
patchback[bot] 2024-11-04 19:35:14 +01:00 committed by GitHub
parent d33467611e
commit 7b9ba8d2e2
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()