More refined logging
This commit is contained in:
parent
c8071fb4d4
commit
1623f1541b
|
@ -1,4 +1,4 @@
|
|||
from datetime import datetime, timezone
|
||||
from datetime import datetime, timedelta, timezone
|
||||
from functools import cached_property
|
||||
from logging import getLogger
|
||||
from os.path import normpath
|
||||
|
@ -217,12 +217,13 @@ class RenewHandler(HandlerBase):
|
|||
if cert_config.max_ttl == 0:
|
||||
cert_config.max_ttl = self._config.defaults.tlsa.ttl
|
||||
utcnow = datetime.now(tz=timezone.utc).timestamp()
|
||||
|
||||
if cert.latest_upcoming_mtime + cert_config.max_ttl > utcnow:
|
||||
delta = utcnow - cert.latest_upcoming_mtime - cert_config.max_ttl
|
||||
tdelta = timedelta(seconds=delta)
|
||||
if delta > 0:
|
||||
# No putting in place necessary yet
|
||||
notify(msg=(
|
||||
'Certificate available in upcoming directory, waiting for TTL '
|
||||
f'expiration ({cert_config.max_ttl} seconds).'))
|
||||
f'expiration ({tdelta} remaining).'))
|
||||
return []
|
||||
notify(msg='TTL expired: moving upcoming certificates in place.')
|
||||
pre_hook(config=cert.cli_config)
|
||||
|
@ -264,8 +265,7 @@ class RenewHandler(HandlerBase):
|
|||
renewed_domains = list[str]()
|
||||
failed_domains = list[str]()
|
||||
for certconfig_path, cert in to_renew.items():
|
||||
notify(msg=(
|
||||
f'\n===== Daneupdate renewal: Checking {certconfig_path}'))
|
||||
notify(msg=f'===== Daneupdate renewal: Checking {certconfig_path}')
|
||||
if certconfig_path in self.all_certs.already_adopted:
|
||||
renewed_domains.extend(self._renew_one_adopted(
|
||||
certconfig_path=certconfig_path, cert=cert))
|
||||
|
@ -275,6 +275,8 @@ class RenewHandler(HandlerBase):
|
|||
renewed, failed = certbot_emu.run_renew_nonadopted_logic()
|
||||
renewed_domains.extend(renewed)
|
||||
failed_domains.extend(failed)
|
||||
# Add empty line
|
||||
notify(msg='')
|
||||
run_saved_post_hooks(
|
||||
renewed_domains=renewed_domains, failed_domains=failed_domains)
|
||||
return 0
|
||||
|
|
Loading…
Reference in New Issue