Commit 26b21b05 authored by Łukasz Nowak's avatar Łukasz Nowak

Fix "Ignore bad signature certificates with message"

Append loaded_certificate in the try block, so it does not result with
"UnboundLocalError: local variable 'loaded_certificate' referenced before assignment"
parent c758f22d
...@@ -216,9 +216,9 @@ class NetworkcacheClient(object): ...@@ -216,9 +216,9 @@ class NetworkcacheClient(object):
for certificate in signature_certificate_list or (): for certificate in signature_certificate_list or ():
try: try:
loaded_certificate = crypto.load_certificate(crypto.FILETYPE_PEM, certificate) loaded_certificate = crypto.load_certificate(crypto.FILETYPE_PEM, certificate)
self.signature_certificate_list.append(loaded_certificate)
except Exception as e: except Exception as e:
logger.info('Ignored wrong certificate, reason:\n%s, offending certificate:\n%s', e, certificate) logger.info('Ignored wrong certificate, reason:\n%s, offending certificate:\n%s', e, certificate)
self.signature_certificate_list.append(loaded_certificate)
# NetworkcacheClient context manager catches all exceptions and logs them # NetworkcacheClient context manager catches all exceptions and logs them
# with INFO severity. This provides a easy way to use a networkcache safely # with INFO severity. This provides a easy way to use a networkcache safely
......
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