Skip to content

Commit

Permalink
ipa-server-guard: make the lock timezone aware
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
flo-renaud committed Aug 17, 2023
1 parent 0f16b72 commit 3354918
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ipaserver/install/certs.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,8 @@ def _read(self, fileobj):
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:
Expand Down

0 comments on commit 3354918

Please sign in to comment.