equal
deleted
inserted
replaced
|
1 This patch is to work-around the fact that Python 2.7.9 and beyond have |
|
2 implemented PEP 476 which enabled certificate verification by default |
|
3 and ZFSSAs may not be deployed with a valid, CA-signed certificate. |
|
4 |
|
5 This patch may be suitable for pushing upsteam. |
|
6 |
|
7 --- cinder-2014.2.2/cinder/volume/drivers/zfssa/restclient.py.~1~ 2015-02-05 08:03:26.000000000 -0800 |
|
8 +++ cinder-2014.2.2/cinder/volume/drivers/zfssa/restclient.py 2015-04-23 17:32:01.898738656 -0700 |
|
9 @@ -17,6 +17,7 @@ ZFS Storage Appliance REST API Client Pr |
|
10 |
|
11 import httplib |
|
12 import json |
|
13 +import ssl |
|
14 import StringIO |
|
15 import time |
|
16 import urllib2 |
|
17 @@ -272,9 +273,18 @@ class RestClientURL(object): |
|
18 if body and body != '': |
|
19 LOG.debug('Body: %s' % body) |
|
20 |
|
21 + if hasattr(ssl, '_create_unverified_context'): |
|
22 + context = ssl._create_unverified_context() |
|
23 + else: |
|
24 + context = None |
|
25 + |
|
26 while retry < maxreqretries: |
|
27 try: |
|
28 - response = urllib2.urlopen(req, timeout=self.timeout) |
|
29 + if context: |
|
30 + response = urllib2.urlopen(req, timeout=self.timeout, |
|
31 + context=context) |
|
32 + else: |
|
33 + response = urllib2.urlopen(req, timeout=self.timeout) |
|
34 except urllib2.HTTPError as err: |
|
35 if err.code == httplib.NOT_FOUND: |
|
36 LOG.debug('REST Not Found: %s' % err.code) |