Ignore InsecureReq warning in SolidFire Driver

The python requests package logs the use of Insecure as
a warning.  Currently the use of http vs https is a
configurable option, and for those that use http, the
log files include a Warning message for every single
request to the SolidFire Cluster.

In our case we're explicitly providing the
option to use http instead of https, so we can safely
ignore this message and remove it from the logs.

Change-Id: I746b5f7d7351ef594bf0004ec76458fc1a633031
This commit is contained in:
John Griffith 2015-08-09 10:00:51 -06:00
parent 2b3f9f8ddb
commit 7584925f43

View File

@ -26,6 +26,9 @@ from oslo_utils import importutils
from oslo_utils import timeutils
from oslo_utils import units
import requests
from requests.packages.urllib3 import exceptions
import warnings
import six
from cinder import context
@ -212,11 +215,13 @@ class SolidFireDriver(san.SanISCSIDriver):
payload = {'method': method, 'params': params}
url = '%s/json-rpc/%s/' % (endpoint['url'], version)
req = requests.post(url,
data=json.dumps(payload),
auth=(endpoint['login'], endpoint['passwd']),
verify=False,
timeout=30)
with warnings.catch_warnings():
warnings.simplefilter("ignore", exceptions.InsecureRequestWarning)
req = requests.post(url,
data=json.dumps(payload),
auth=(endpoint['login'], endpoint['passwd']),
verify=False,
timeout=30)
response = req.json()
req.close()