Fix: ERROR: local variable 'certdir' referenced before assignment

This commit is contained in:
Alexey Ryndin 2023-12-06 13:57:56 +03:00
parent 474787dab7
commit 3361c79c1e
1 changed files with 1 additions and 1 deletions

View File

@ -110,10 +110,10 @@ class TofuStore:
self.db_conn.commit()
break
else:
certdir = os.path.join(self.config_dir, "cert_cache")
if _HAS_CRYPTOGRAPHY:
# Load the most frequently seen certificate to see if it has
# expired
certdir = os.path.join(self.config_dir, "cert_cache")
with open(os.path.join(certdir, most_frequent_cert+".crt"), "rb") as fp:
previous_cert = fp.read()
previous_cert = x509.load_der_x509_certificate(previous_cert, _BACKEND)