Skip to content

Commit

Permalink
Raise exception when there're no CA certificates
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
AMDmi3 committed Feb 5, 2013
1 parent 8cd08c3 commit 8e9e8c4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions osc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,8 @@ def retry_http_basic_auth(self, host, req, realm):
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')
Expand Down

0 comments on commit 8e9e8c4

Please sign in to comment.