Skip to content

Commit

Permalink
Handle error when the CRL is not writable.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphbean committed Dec 11, 2012
1 parent 2a06db1 commit 8189ac8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fedmsg/crypto.py
Expand Up @@ -142,6 +142,7 @@
import fedmsg.encoding

import logging
log = logging.getLogger('fedmsg')

try:
import M2Crypto
Expand All @@ -150,7 +151,6 @@
import m2ext
except ImportError, e:
logging.basicConfig()
log = logging.getLogger('fedmsg')
log.warn("Crypto disabled %r" % e)


Expand Down Expand Up @@ -197,7 +197,6 @@ def validate(message, ssldir, **config):
"""

def fail(reason):
log = logging.getLogger('fedmsg')
log.warn("Failed validation. %s" % reason)
return False

Expand Down Expand Up @@ -332,7 +331,8 @@ def _load_crl(crl_location="https://fedoraproject.org/fedmsg/crl.pem",
with open(crl_cache, 'w') as f:
f.write(response.content)
except requests.exceptions.ConnectionError:
log = logging.getLogger('fedmsg')
log.warn("Could not access %r" % crl_location)
except IOError as e:
log.warn("Could not write %r. %r" % (crl_cache, e))

return M2Crypto.X509.load_crl(crl_cache)

0 comments on commit 8189ac8

Please sign in to comment.