Add support for custom site-specific management commands.

Review Request #1447 — Created March 4, 2010 and submitted

chipx86
Review Board
master
reviewboard
Add support for custom site-specific management commands.

This change introduces the ability to write custom management commands specific
to a site installation.

This uses standard Django management commands. They can be placed in
the site's commands/ directory. `rb-site manage` will look for Python files
in this directory and add them to the known list of management commands.

Today, adding them to the list is pretty hacky, but there aren't any other
options. We will probably want to request the ability to cleanly register
new commands in Django. It works though, and we can update it if needed
down the road.
Built a sample 'mytest' management command and put it in the commands/ directory of a site. Ran 'rb-site manage /path/to/site mytest' and saw the output from the management command.
david
  1. What's the impetus for this change?
    1. Every so often someone posts a script that needs access to the Review Board database, and they have to mess with the settings. This would allow them to just write it as a management command. Also, we've hit cases in the past where we've needed a management command to solve some problem (broken screenshots, dup reviews issues, etc.) and have had to stick the management command in the source tree, which doesn't survive upgrades. This is a far more flexible design. It'd also let us write one-off fixes for things (superuser resets or auth resets, for instance) and hand them to someone to use.
  2. 
      
david
  1. Okay, looks good.
  2. 
      
Loading...