ipa-epn: include timezone info
ipa-epn is using timezone-aware timestamps for "now" but converts krbpasswordexpiration attribute into a naive datetime object that is missing the tzinfo. It is not possible to substract timezone aware and naive values. Convert krbpasswordexpiration attribute into an UTC value before doing the substration. 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
7796b7b958
commit
59e68f79e4
1 file changed
+1
-1
@@ -571,7 +571,7 @@ class EPN(admintool.AdminTool):
|
||||
now = datetime.now(tz=UTC)
|
||||
expdate = datetime.strptime(
|
||||
entry["krbpasswordexpiration"],
|
||||
'%Y-%m-%d %H:%M:%S')
|
||||
'%Y-%m-%d %H:%M:%S').replace(tzinfo=UTC)
|
||||
logger.debug(
|
||||
"Notified %s (%s). Password expiring in %d days at %s.",
|
||||
entry["mail"], entry["uid"], (expdate - now).days,
|
||||
|
||||
Reference in new issue
Block a user