From 4cfc751902f4a4d3aa02a3550ecf4fc0476d3a20 Mon Sep 17 00:00:00 2001 From: CroneKorkN Date: Fri, 23 Oct 2026 15:21:51 +0200 Subject: [PATCH] fix(backup-freshness-check): compare timezone-aware UTC datetimes utcfromtimestamp is deprecated and its warning ended up in the check output; it also compared a UTC snapshot time with local now. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01RywMtsL8qXG7GDY3MHq9Uh --- .../backup-freshness-check/files/check_backup_freshness | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bundles/backup-freshness-check/files/check_backup_freshness b/bundles/backup-freshness-check/files/check_backup_freshness index 9bc8227..1079150 100644 --- a/bundles/backup-freshness-check/files/check_backup_freshness +++ b/bundles/backup-freshness-check/files/check_backup_freshness @@ -2,10 +2,10 @@ import json from subprocess import check_output -from datetime import datetime, timedelta +from datetime import datetime, timedelta, timezone -now = datetime.now() +now = datetime.now(timezone.utc) two_days_ago = now - timedelta(days=2) with open('/etc/backup-freshness-check.json', 'r') as file: @@ -30,8 +30,9 @@ for dataset in config['datasets']: continue newest_backup_snapshot = snapshots[-1] - snapshot_datetime = datetime.utcfromtimestamp( - int(check_output(['zfs', 'list', '-p', '-H', '-o', 'creation', '-t', 'snapshot', newest_backup_snapshot]).decode()) + snapshot_datetime = datetime.fromtimestamp( + int(check_output(['zfs', 'list', '-p', '-H', '-o', 'creation', '-t', 'snapshot', newest_backup_snapshot]).decode()), + timezone.utc, ) if snapshot_datetime < two_days_ago: