Commit f47b10af authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼 Committed by Julien Muchembled

fix for old version of SSL

"context.set_ciphers('DEFAULT:@SECLEVEL=1')" was introduced in
ab3b2c3b but for very old SSL we can have the
follwoing error:

Traceback (most recent call last):
  File "/usr/local/bin/networkcache-upload", line 9, in <module>
    load_entry_point('slapos.libnetworkcache==0.19', 'console_scripts', 'networkcache-upload')()
  File "/usr/local/lib/python2.7/dist-packages/slapos/libnetworkcache.py", line 489, in cmd_upload
    **dict(x.split('=', 1) for x in args.meta))
  File "/usr/local/lib/python2.7/dist-packages/slapos/libnetworkcache.py", line 341, in upload
    'Content-Type': 'application/octet-stream'})
  File "/usr/local/lib/python2.7/dist-packages/slapos/libnetworkcache.py", line 264, in _request
    context.set_ciphers('DEFAULT:@SECLEVEL=1') # XXX
ssl.SSLError: ('No cipher can be selected.',)

/reviewed-on !3
parent cb63f48c
......@@ -261,7 +261,10 @@ class NetworkcacheClient(object):
connection_kw['context'] = ssl.create_default_context(
cafile=self.config.get('sha%s-ca-file' % where)
)
context.set_ciphers('DEFAULT:@SECLEVEL=1') # XXX
try:
context.set_ciphers('DEFAULT:@SECLEVEL=1') # XXX
except ssl.SSLError:
pass
is_https = True
connection = HTTPSConnection(**connection_kw)
else:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment