1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-12-25 17:36:13 +01:00

Raise exception when there're no CA certificates

This is more useful and meaningful error message than M2Crypto's
"ValueError: cafile and capath can not both be None." when neither
of cafile and capath is defined for load_verify_locations call.
This commit is contained in:
Dmitry Marakasov 2013-02-06 03:50:18 +04:00
parent 8cd08c352b
commit 8e9e8c492c

View File

@ -496,6 +496,8 @@ def _build_opener(url):
elif os.path.isdir(i):
capath = i
break
if not cafile and not capath:
raise Exception('No CA certificates found')
ctx = oscssl.mySSLContext()
if ctx.load_verify_locations(capath=capath, cafile=cafile) != 1:
raise Exception('No CA certificates found')