From 33549183effa3a880f2d79955939b25142e72ff9 Mon Sep 17 00:00:00 2001 From: Florence Blanc-Renaud Date: Thu, 10 Aug 2023 16:51:22 +0200 Subject: [PATCH] ipa-server-guard: make the lock timezone aware ipa-server-guard reads a lock file in order to check if the lock is still taken by comparing the stored value, for instance: expire = 20230810155452589311 with the current datetime. The expire value needs to be timezone-aware in order to be compared with "now" which is also tz aware. Related: https://pagure.io/freeipa/issue/9425 Signed-off-by: Florence Blanc-Renaud Reviewed-By: Alexander Bokovoy --- ipaserver/install/certs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ipaserver/install/certs.py b/ipaserver/install/certs.py index 0ec001a75..0fb126d24 100644 --- a/ipaserver/install/certs.py +++ b/ipaserver/install/certs.py @@ -799,7 +799,8 @@ class _CrossProcessLock: expire = p.get('lock', 'expire') try: self._expire = datetime.datetime.strptime( - expire, self._DATETIME_FORMAT) + expire, self._DATETIME_FORMAT).replace( + tzinfo=datetime.UTC) except ValueError: raise configparser.Error except configparser.Error: