Added more logging

This commit is contained in:
Nav
2015-11-13 11:44:10 +02:00
parent cec5bb8b84
commit 6760355a23
+5
View File
@@ -265,6 +265,7 @@ class RenewableCert(object): # pylint: disable=too-many-instance-attributes
raise errors.CertStorageError("unknown kind of item") raise errors.CertStorageError("unknown kind of item")
link = getattr(self, kind) link = getattr(self, kind)
if not os.path.exists(link): if not os.path.exists(link):
logger.debug("File does not exist")
return None return None
target = os.readlink(link) target = os.readlink(link)
if not os.path.isabs(target): if not os.path.isabs(target):
@@ -289,11 +290,13 @@ class RenewableCert(object): # pylint: disable=too-many-instance-attributes
pattern = re.compile(r"^{0}([0-9]+)\.pem$".format(kind)) pattern = re.compile(r"^{0}([0-9]+)\.pem$".format(kind))
target = self.current_target(kind) target = self.current_target(kind)
if target is None or not os.path.exists(target): if target is None or not os.path.exists(target):
logger.debug("File does not exist")
target = "" target = ""
matches = pattern.match(os.path.basename(target)) matches = pattern.match(os.path.basename(target))
if matches: if matches:
return int(matches.groups()[0]) return int(matches.groups()[0])
else: else:
logger.debug("No matches")
return None return None
def version(self, kind, version): def version(self, kind, version):
@@ -543,6 +546,7 @@ class RenewableCert(object): # pylint: disable=too-many-instance-attributes
# Renewals on the basis of revocation # Renewals on the basis of revocation
if self.ocsp_revoked(self.latest_common_version()): if self.ocsp_revoked(self.latest_common_version()):
logger.debug("Should renew, certificate is revoked")
return True return True
# Renewals on the basis of expiry time # Renewals on the basis of expiry time
@@ -551,6 +555,7 @@ class RenewableCert(object): # pylint: disable=too-many-instance-attributes
"cert", self.latest_common_version())) "cert", self.latest_common_version()))
now = pytz.UTC.fromutc(datetime.datetime.utcnow()) now = pytz.UTC.fromutc(datetime.datetime.utcnow())
if expiry < add_time_interval(now, interval): if expiry < add_time_interval(now, interval):
logger.debug("Should renew, certificate is expired")
return True return True
return False return False