[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
parent
d33467611e
commit
7b9ba8d2e2
|
@ -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).
|
|
@ -276,16 +276,18 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
|
||||||
|
|
||||||
def _get_auth(self):
|
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:
|
if self.proxmox_password:
|
||||||
|
|
||||||
credentials = urlencode({'username': self.proxmox_user, 'password': self.proxmox_password})
|
credentials = urlencode({'username': self.proxmox_user, 'password': self.proxmox_password})
|
||||||
|
|
||||||
a = self._get_session()
|
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)
|
ret = a.post('%s/api2/json/access/ticket' % self.proxmox_url, data=credentials)
|
||||||
|
|
||||||
json = ret.json()
|
json = ret.json()
|
||||||
|
|
Loading…
Reference in New Issue