mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
vmware_tools: ignore absence of urllib3
This commit is contained in:
parent
f40778cae3
commit
05fe9ef816
1 changed files with 9 additions and 2 deletions
|
@ -10,9 +10,16 @@ from os.path import exists, getsize
|
|||
from socket import gaierror
|
||||
from ssl import SSLError
|
||||
from time import sleep
|
||||
import urllib3
|
||||
import traceback
|
||||
|
||||
URLLIB3_IMP_ERR = None
|
||||
try:
|
||||
import urllib3
|
||||
HAS_URLLIB3 = True
|
||||
except ImportError:
|
||||
URLLIB3_IMP_ER = traceback.format_exc()
|
||||
HAS_URLLIB3 = False
|
||||
|
||||
REQUESTS_IMP_ERR = None
|
||||
try:
|
||||
import requests
|
||||
|
@ -290,7 +297,7 @@ class Connection(ConnectionBase):
|
|||
if self.validate_certs:
|
||||
connect = SmartConnect
|
||||
else:
|
||||
if self.get_option("silence_tls_warnings"):
|
||||
if HAS_URLLIB3 and self.get_option("silence_tls_warnings"):
|
||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||
connect = SmartConnectNoSSL
|
||||
|
||||
|
|
Loading…
Reference in a new issue