Update rb-site to allow for automation

Review Request #693 — Created Jan. 12, 2009 and submitted

Information

Review Board SVN (deprecated)
trunk

Reviewers

Adds a --noinput option that requires the use of a new set of options to specify answers to the normally prompted questions.
$ ./rb-site install /tmp/rbtest --domain-name review.example.com --db-type postgresql --db-user reviewboard --db-pass foo --cache-type memcached --cache-info memcached://localhost:11211/ --web-server-type apache --python-loader modpython --admin-password bar --admin-email foo@example.com --noinput


* Installing the site...
Building site directories ... OK
Building site configuration files ... OK
Creating database ... Installing json fixture 'initial_data' from '/usr/lib/python2.5/site-packages/ReviewBoard-0.9.dev_20090108-py2.5.egg/reviewboard/scmtools/fixtures'.
Installed 6 object(s) from 1 fixture(s)
OK
Performing migrations ... No evolution required.
OK
Creating administrator account ... OK
Saving site settings ... OK


* The site has been installed

    The site has been installed in /tmp/rbtest

    Sample configuration files for web servers and cron are available
    in the conf/ directory.

    You need to modify the ownership of htdocs/media/uploaded
    directory and all of its contents to be owned by the web server.
chipx86
  1. Thanks for doing this work! Some things I'd like to see before it goes in, though.
  2. Can you rename this to --noinput? That way we're more consistent with some of the manage commands we use.
  3. /trunk/reviewboard/contrib/tools/rb-site (Diff revision 1)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    I know it's a bit of extra work, but can you add help for these?
  4. /trunk/reviewboard/contrib/tools/rb-site (Diff revision 1)
     
     
     
    We should have some constants for these defaults, since we use them in a couple of places now. It'd be nice to define them once.
  5. /trunk/reviewboard/contrib/tools/rb-site (Diff revision 1)
     
     
     
     
     
     
    I'd prefer to split this up a bit. Do the option handling in here, and force ConsoleUI if the noinput option is set in main(), just like how we have "force_console."
    
    Also, some style guidelines:
    
    1) One statement per line. Don't put the for loop and the setattr in the same line.
    2) No space before colons.
    
    I think we can actually condense this, though. Try:
    
    site.__dict__.update(options.__dict__)
    1. Also, these options should be used as defaults regardless of whether --no-questions/--noinput is used. It would be nice to specify them on the command line and see them as defaults in the UI. This can be a separate change by either you or I though if it turns out to be non-trivial.
    2. I have updated based on your initial feedback.  Using the the args to set /defaults/ without --noinput is doable, but if someone went to the effort to type all that out, do they want to be bothered with the UI for that option?  Using the args to skip individual options is more difficult as the defaults shadow whether the option was included as an argument or not.
  6. 
      
GI
GI
chipx86
  1. Thanks for your work on this. Sorry for the delay in getting back to you. I've been busy this past couple of weeks and haven't been able to devote as much time to contributions.
    
    There's still some things to fix before this goes in.
  2. No need for the ()
    1. Whole class removed.
  3. Space before and after the "="
    1. Whole class removed.
  4. Something like "uses values passed to rb-site instead of prompting for input" might make more sense here.
  5. I'd rather avoid abbreviations in the help description. Not everyone knows "FQDN".
  6. /trunk/reviewboard/contrib/tools/rb-site (Diff revision 2)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    I'd prefer help descriptions that are more in line with what we say in the installer. Instead of just listing possible values, for instance, these should describe what the parameter does and then list possible options in parenthesis.
  7. /trunk/reviewboard/contrib/tools/rb-site (Diff revision 2)
     
     
     
     
     
    I think if we just always do the update, even when not dependent on noinput, we'll get the script defaults for free.
    
    This is actually useful for companies that are doing multiple site installations but always want to use, say, the same media path. They can wrap rb-site to provide those defaults for the interactive installer.
  8. 
      
GI
Review request changed

Change Summary:

Updated diff based on feedback.

Description:

~  

Adds a --noinput option that enables/requires the use of a new set of options to specify answers to the normally prompted questions.

  ~

Adds a --noinput option that requires the use of a new set of options to specify answers to the normally prompted questions.

Diff:

Revision 3 (+68 -26)

Show changes

chipx86
  1. Thanks! Committed with some small modifications as r1673.
  2. 
      
Loading...