New users not getting an expiration date

Bug #1631509 reported by Paul Everitt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
KARL4
Fix Released
Medium
Carlos de la Guardia

Bug Description

The cron job generated this traceback last night:

Sent reminder to user 'Balint Attila Horvath'
Traceback (most recent call last):
  File "/srv/osfkarl/production/current/bin/password_reset_reminder", line 121, in <module>
    sys.exit(karl.scripts.password_reset_reminder.main())
  File "/srv/osfkarl/production/84/eggs/karl-4.19-py2.7.egg/karl/scripts/password_reset_reminder.py", line 102, in main
    send_reminders(env, start, end)
  File "/srv/osfkarl/production/84/eggs/karl-4.19-py2.7.egg/karl/scripts/password_reset_reminder.py", line 59, in send_reminders
    if expiration > start and expiration < end:
TypeError: can't compare datetime.datetime to NoneType

I presume that we aren't assigning a password expiration date during GSA creating a user (or some other place when a user gets created.) Perhaps solved with an event subscriber.

Revision history for this message
Carlos de la Guardia (cguardia) wrote :

Fixed.

Changed in karl4:
status: New → Fix Committed
Revision history for this message
Paul Everitt (paul-agendaless) wrote : Re: [Bug 1631509] New users not getting an expiration date

I’ll also need an evolve script that assigns everyone without an expiration date, an expiration date, 180 days in the future.

—Paul

> On Oct 8, 2016, at 10:38 PM, Carlos de la Guardia <email address hidden> wrote:
>
> Fixed.
>
> ** Changed in: karl4
> Status: New => Fix Committed
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1631509
>
> Title:
> New users not getting an expiration date
>
> Status in KARL4:
> Fix Committed
>
> Bug description:
> The cron job generated this traceback last night:
>
> Sent reminder to user 'Balint Attila Horvath'
> Traceback (most recent call last):
> File "/srv/osfkarl/production/current/bin/password_reset_reminder", line 121, in <module>
> sys.exit(karl.scripts.password_reset_reminder.main())
> File "/srv/osfkarl/production/84/eggs/karl-4.19-py2.7.egg/karl/scripts/password_reset_reminder.py", line 102, in main
> send_reminders(env, start, end)
> File "/srv/osfkarl/production/84/eggs/karl-4.19-py2.7.egg/karl/scripts/password_reset_reminder.py", line 59, in send_reminders
> if expiration > start and expiration < end:
> TypeError: can't compare datetime.datetime to NoneType
>
> I presume that we aren't assigning a password expiration date during
> GSA creating a user (or some other place when a user gets created.)
> Perhaps solved with an event subscriber.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/karl4/+bug/1631509/+subscriptions

Revision history for this message
Carlos de la Guardia (cguardia) wrote :

Added evolve script.

Revision history for this message
Paul Everitt (paul-agendaless) wrote :

I don't think this had an effect: https://github.com/karlproject/karl/commit/08097345a593d374e98aa2b36aeffcccdb3a9494

karlstaging is at database revision 49, so something ran. But the following produced a long list of users with "None" as the password expiration date:

>>> ped = 'password_expiration_date'
>>> profiles = root['profiles']
>>> for u, p in profiles.items():
>>> if not p.get(ped): print u, p.get(ped)

Changed in karl4:
importance: High → Medium
status: Fix Committed → In Progress
Changed in karl4:
milestone: 024 → 025
Changed in karl4:
milestone: 025 → 026
Changed in karl4:
milestone: 026 → 027
Changed in karl4:
milestone: 027 → 028
Revision history for this message
Carlos de la Guardia (cguardia) wrote :

Sorry this took me so long to look at. You need to use getattr(p, ped), rather than the repoze.folder get call, which returns contained items.

Revision history for this message
Paul Everitt (paul-agendaless) wrote : Re: [Bug 1631509] Re: New users not getting an expiration date

Is this something you’d like me to do the PR for?

—Paul

> On Feb 1, 2017, at 12:22 AM, Carlos de la Guardia <email address hidden> wrote:
>
> Sorry this took me so long to look at. You need to use getattr(p, ped),
> rather than the repoze.folder get call, which returns contained items.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1631509
>
> Title:
> New users not getting an expiration date
>
> Status in KARL4:
> In Progress
>
> Bug description:
> The cron job generated this traceback last night:
>
> Sent reminder to user 'Balint Attila Horvath'
> Traceback (most recent call last):
> File "/srv/osfkarl/production/current/bin/password_reset_reminder", line 121, in <module>
> sys.exit(karl.scripts.password_reset_reminder.main())
> File "/srv/osfkarl/production/84/eggs/karl-4.19-py2.7.egg/karl/scripts/password_reset_reminder.py", line 102, in main
> send_reminders(env, start, end)
> File "/srv/osfkarl/production/84/eggs/karl-4.19-py2.7.egg/karl/scripts/password_reset_reminder.py", line 59, in send_reminders
> if expiration > start and expiration < end:
> TypeError: can't compare datetime.datetime to NoneType
>
> I presume that we aren't assigning a password expiration date during
> GSA creating a user (or some other place when a user gets created.)
> Perhaps solved with an event subscriber.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/karl4/+bug/1631509/+subscriptions

Revision history for this message
Carlos de la Guardia (cguardia) wrote :

No, no. I meant the attribute is there already, but you got None because you made the get call and the password_expiration_date is not a folder item. If you make your script check for the expiration date with getattr, you'll see the values.

Revision history for this message
Paul Everitt (paul-agendaless) wrote :

Can you confirm that, in production, users created in the last month are getting the expiration set?

Revision history for this message
Carlos de la Guardia (cguardia) wrote :

Just ran the script on osfkarl11, got no empty passwords.

Revision history for this message
Paul Everitt (paul-agendaless) wrote :

Cool, let's close it.

Changed in karl4:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.