Changeset c3a573c for fedd/federation
- Timestamp:
- Feb 13, 2015 10:08:10 AM (10 years ago)
- Branches:
- master
- Children:
- 187a8f9
- Parents:
- 36e701e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/util.py
r36e701e rc3a573c 8 8 9 9 import httplib 10 import ssl 10 11 11 12 from optparse import OptionParser … … 216 217 ok = False 217 218 failed_exception = None 219 # Build a context on modern systems, on old ones fall back to the old 220 # HTTPSConnection definition. 221 context = None 222 try: 223 # This context does not check the self-signed server cert 224 context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) 225 context.load_cert_chain(cf) 226 except AttributeError: 227 pass 218 228 while not ok and retries < max_retries: 219 229 try: 220 conn = httplib.HTTPSConnection(po.hostname, port=po.port, 221 cert_file=cf, key_file=cf, timeout=30) 230 if context is not None: 231 conn = httplib.HTTPSConnection(po.hostname, port=po.port, 232 timeout=30, context=context) 233 else: 234 conn = httplib.HTTPSConnection(po.hostname, port=po.port, 235 cert_file=cf, key_file=cf, timeout=30) 222 236 conn.putrequest('GET', po.path) 223 237 conn.endheaders() … … 244 258 retries += 1 245 259 246 if retries > max_retries and failed_exception:260 if retries >= max_retries and failed_exception: 247 261 if log: 248 262 log.debug('Raising %s', failed_exception) 249 raise failed_exc petion263 raise failed_exception 250 264 251 265 # Functions to manipulate composite testbed names
Note: See TracChangeset
for help on using the changeset viewer.