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
parent
94e3635c0a
commit
886d4a6596
|
@ -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):
|
||||
|
||||
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()
|
||||
|
|
Loading…
Reference in New Issue