Opened 4 years ago

Closed 4 years ago

#17898 closed Bug (fixed)

The database option is not honored when `createsuperuser` is called by `syncdb`

Reported by: charettes Owned by: nobody
Component: contrib.auth Version: 1.3
Severity: Release blocker Keywords: syncdb createsuperuser database multidb
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: no UI/UX: no


When calling the syncdb command with a database kwarg

./ syncdb --database my_specific_db

The post_sync_db signal is dispatched correctly but the receiver doesn't take the db kwarg into account when calling createsuperuser thus it attempts to create it on the default database. It should call the command on the database specified in syncdb.

I'm attaching a patch but I really don't know where I should add tests for this, I can't find where syncdb is tested. Is it??

Attachments (1)

syncdb-multidb-createsuperuser.diff (1021 bytes) - added by charettes 4 years ago.

Download all attachments as: .zip

Change History (4)

Changed 4 years ago by charettes

comment:1 Changed 4 years ago by julien

  • Needs documentation unset
  • Needs tests set
  • Patch needs improvement unset
  • Severity changed from Normal to Release blocker

I haven't verified the issue yet, but this could potentially be a bug in a new feature (added in [17898]), therefore marking as release blocker.

Version 0, edited 4 years ago by julien (next)

comment:2 Changed 4 years ago by charettes

I can confirm r17665 introduced the regression.

Everything worked just fine before this changeset since I was using a router to specify the User's db_for_(write|read). Now that using(database) is explicitly called in the createsuperuser command it's not asking the router anymore therefore triggering this issue.

comment:3 Changed 4 years ago by ubernostrum

  • Resolution set to fixed
  • Status changed from new to closed

In [17738]:

Fixed #17898: Ensure create_superuser honors the 'db' argument from post_sync_db. Thanks to charettes for the patch.

Note: See TracTickets for help on using tickets.
Back to Top