peeringdb / peeringdb

Server code for https://www.peeringdb.com/
BSD 2-Clause "Simplified" License
343 stars 111 forks source link

pdb_delete_outdated_pending_affil_request failure #1608

Open vegu opened 1 month ago

vegu commented 1 month ago

Describe the bug

cronjob running the new pdb_delete_outdated_pending_affil_request command has logged the following error which should be looked at. Its when the script encounters affiliation requests that have not been related to an organization object.

Traceback (most recent call last):
  File "/srv/[www.peeringdb.com/./manage.py](http://www.peeringdb.com/manage.py)", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/srv/[www.peeringdb.com/venv/lib/python3.11/site-packages/django/core/management/__init__.py](http://www.peeringdb.com/venv/lib/python3.11/site-packages/django/core/management/__init__.py)", line 442, in execute_from_command_line
    utility.execute()
  File "/srv/[www.peeringdb.com/venv/lib/python3.11/site-packages/django/core/management/__init__.py](http://www.peeringdb.com/venv/lib/python3.11/site-packages/django/core/management/__init__.py)", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/srv/[www.peeringdb.com/venv/lib/python3.11/site-packages/django/core/management/base.py](http://www.peeringdb.com/venv/lib/python3.11/site-packages/django/core/management/base.py)", line 412, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/srv/[www.peeringdb.com/venv/lib/python3.11/site-packages/django/core/management/base.py](http://www.peeringdb.com/venv/lib/python3.11/site-packages/django/core/management/base.py)", line 458, in execute
    output = self.handle(*args, **options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/[www.peeringdb.com/peeringdb_server/management/commands/pdb_delete_outdated_pending_affil_request.py](http://www.peeringdb.com/peeringdb_server/management/commands/pdb_delete_outdated_pending_affil_request.py)", line 70, in handle
    self.process_requests(old_requests, days_old)
  File "/srv/[www.peeringdb.com/peeringdb_server/management/commands/pdb_delete_outdated_pending_affil_request.py](http://www.peeringdb.com/peeringdb_server/management/commands/pdb_delete_outdated_pending_affil_request.py)", line 85, in process_requests
    self.send_email_notifications(request, days_old)
  File "/srv/[www.peeringdb.com/peeringdb_server/management/commands/pdb_delete_outdated_pending_affil_request.py](http://www.peeringdb.com/peeringdb_server/management/commands/pdb_delete_outdated_pending_affil_request.py)", line 94, in send_email_notifications
    for admin in request.org.admin_usergroup.user_set.all():
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'admin_usergroup'

What is the impact? This is a clean up job, that cleans up old affiliation requests that was recently implemented through #1415

leovegoda commented 1 month ago

Setting to Ready for Implementation as a developer identified bug