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 <flo@redhat.com> Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
1 parent
0f16b72bcb
commit
33549183ef
1 file changed
+2
-1
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user