mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-20 20:00:23 -07:00
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>
This commit is contained in:
parent
94e3635c0a
commit
886d4a6596
2 changed files with 8 additions and 4 deletions
2
changelogs/fragments/9099-proxmox-fix-insecure.yml
Normal file
2
changelogs/fragments/9099-proxmox-fix-insecure.yml
Normal 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).
|
|
@ -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…
Add table
Add a link
Reference in a new issue