Muehlenhoff has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/346254 )

Change subject: Fix date calculation for accounts with expiry date
......................................................................


Fix date calculation for accounts with expiry date

expiry is a date, while current_date was a timedate, so this was effectively
-1 a second after midnight.

Change-Id: I3d61fa56a774284a1f3042408a841ab9afe64a87
---
M modules/openldap/files/cross-validate-accounts.py
1 file changed, 2 insertions(+), 2 deletions(-)

Approvals:
  Muehlenhoff: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/openldap/files/cross-validate-accounts.py 
b/modules/openldap/files/cross-validate-accounts.py
index 3508e01..aac52ef 100644
--- a/modules/openldap/files/cross-validate-accounts.py
+++ b/modules/openldap/files/cross-validate-accounts.py
@@ -192,11 +192,11 @@
 # Warn if an account expires in 14 days or less
 def print_pending_account_expirys(users):
     log = ""
-    current_date = datetime.datetime.now()
+    current_date = datetime.datetime.now().date()
     for i in users.keys():
         attrs = users[i]
         if 'expiry_date' in attrs.keys():
-            expiry = datetime.datetime.strptime(str(attrs['expiry_date']), 
"%Y-%m-%d")
+            expiry = datetime.datetime.strptime(str(attrs['expiry_date']), 
"%Y-%m-%d").date()
             delta = expiry - current_date
             if delta.days <= 14:
                 log += "The NDA/MOU for " + i + " will lapse in " + 
str(delta.days) + " days.\n"

-- 
To view, visit https://gerrit.wikimedia.org/r/346254
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3d61fa56a774284a1f3042408a841ab9afe64a87
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Muehlenhoff <mmuhlenh...@wikimedia.org>
Gerrit-Reviewer: Muehlenhoff <mmuhlenh...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to