Skip to content

reset-admin-password triggers 'UserManager' object has no attribute 'make_random_password' #7533

@ianballou

Description

@ianballou

Version
All versions with Django 5 (tested on 3.105)

Describe the bug
reset-admin-password.py contains a call to User.objects.make_random_password, but the method was removed in Django 5.1 (https://django.readthedocs.io/en/stable/releases/5.1.html#features-removed-in-5-1)

To Reproduce
Run the reset-admin-password management command

  File "/usr/local/bin/pulpcore-manager", line 8, in <module>                                                                                                     
    sys.exit(manage())                                                                                                                                            
             ^^^^^^^^                                                                                                                                             
  File "/usr/local/lib/python3.11/site-packages/pulpcore/app/manage.py", line 11, in manage                                                                       
    execute_from_command_line(sys.argv)                                                                                                                           
  File "/usr/local/lib/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line                                       
    utility.execute()                                                                                                                                             
  File "/usr/local/lib/python3.11/site-packages/django/core/management/__init__.py", line 436, in execute                                                         
    self.fetch_command(subcommand).run_from_argv(self.argv)                                                                                                       
  File "/usr/local/lib/python3.11/site-packages/django/core/management/base.py", line 420, in run_from_argv                                                       
    self.execute(*args, **cmd_options)                                                                                                                            
  File "/usr/local/lib/python3.11/site-packages/django/core/management/base.py", line 464, in execute                                                             
    output = self.handle(*args, **options)                                                                                                                        
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                        
  File "/usr/local/lib/python3.11/site-packages/pulpcore/app/management/commands/reset-admin-password.py", line 37, in handle                                     
    password = User.objects.make_random_password(length=20)                                                                                                       
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                  
AttributeError: 'UserManager' object has no attribute 'make_random_password' 

Expected behavior
The password is reset without error

Additional context
Add any other context about the problem here. Please provide links to any previous discussions via Discourse or Bugzilla.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions