mirror of
https://github.com/openSUSE/osc.git
synced 2025-08-24 15:18:54 +02:00
- raise more specific exceptions
This commit is contained in:
@@ -513,10 +513,10 @@ def _build_opener(url):
|
|||||||
capath = i
|
capath = i
|
||||||
break
|
break
|
||||||
if not cafile and not capath:
|
if not cafile and not capath:
|
||||||
raise Exception('No CA certificates found')
|
raise oscerr.OscIOError(None, 'No CA certificates found')
|
||||||
ctx = oscssl.mySSLContext()
|
ctx = oscssl.mySSLContext()
|
||||||
if ctx.load_verify_locations(capath=capath, cafile=cafile) != 1:
|
if ctx.load_verify_locations(capath=capath, cafile=cafile) != 1:
|
||||||
raise Exception('No CA certificates found')
|
raise oscerr.OscIOError(None, 'No CA certificates found')
|
||||||
opener = m2urllib2.build_opener(ctx, oscssl.myHTTPSHandler(ssl_context=ctx, appname='osc'), HTTPCookieProcessor(cookiejar), authhandler, proxyhandler)
|
opener = m2urllib2.build_opener(ctx, oscssl.myHTTPSHandler(ssl_context=ctx, appname='osc'), HTTPCookieProcessor(cookiejar), authhandler, proxyhandler)
|
||||||
else:
|
else:
|
||||||
print("WARNING: SSL certificate checks disabled. Connection is insecure!\n", file=sys.stderr)
|
print("WARNING: SSL certificate checks disabled. Connection is insecure!\n", file=sys.stderr)
|
||||||
|
Reference in New Issue
Block a user