Make 'rb-site upgrade' replace the example crontab.

Review Request #6096 — Created July 10, 2014 and submitted

Information

Review Board
release-2.0.x
08daf25...

Reviewers

Because we changed search backends from PyLucene to Haystack, users need to
change their crontabs to use the new indexing commands. This change makes it so
that we replace the example crontab in the site directory with the templated
version on upgrade.

Some changes had to be made to template processing to avoid making assumptions
about some of the data, since upgrade doesn't ask any questions about domain
name, site root, etc. These aren't required for the cron template, so it all
works OK.

Created a 1.7.x site directory and saw that the sample crontab listed our old
PyLucene-based indexing commands. Ran 'rb-site upgrade' with this code and saw
it replaced with the new Haystack management commands.

Description From Last Updated

import 'choice' from line 17 shadowed by loop variable

reviewbotreviewbot

Blank line before this.

chipx86chipx86

Do we allow empty entries for the site root? I thought we required a value. If not, we should require …

chipx86chipx86

Maybe do this at a different time from the rebuild_index, so we don't swamp the database. (Do we need to …

chipx86chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/cmdline/rbsite.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/cmdline/rbsite.py
    
    
  2. reviewboard/cmdline/rbsite.py (Diff revision 1)
     
     
    Show all issues
     import 'choice' from line 17 shadowed by loop variable
    
  3. 
      
david
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/cmdline/rbsite.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/cmdline/rbsite.py
    
    
  2. 
      
chipx86
  1. Can we also fix the crontab to do two more things:

    1) Run rb-site manage /path/to/site cleanup (for session cleanup) periodically (once a day?)
    2) Use the -a (age) argument for update_index. (I think the minimum value is 1 hour, so -a 1). Otherwise, update_index looks at all review requests in the database.

    We'll probably want to rename the cron file for #1, but I think it's worth it.

  2. reviewboard/cmdline/rbsite.py (Diff revision 2)
     
     
    Show all issues

    Blank line before this.

  3. reviewboard/cmdline/rbsite.py (Diff revision 2)
     
     
     
     
     
     
     
    Show all issues

    Do we allow empty entries for the site root? I thought we required a value. If not, we should require one, since we default to '/'.

    1. I'm not 100% sure, but I think it must be fine, since otherwise we'd get IndexErrors on the slice. This code doesn't introduce any new problems, though.

    2. I was trying to figure out the reason for this code change, since the old code worked perfectly fine, so long as that assumption was correct. The wizard definitely requires an answer. I figured you must have hit a bug somewhere with this. If such a bug exists, I'd rather fix it at the source rather than bandaid it here.

  4. 
      
david
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/cmdline/rbsite.py
    
    Ignored Files:
        reviewboard/cmdline/conf/cron.conf.in
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/cmdline/rbsite.py
    
    Ignored Files:
        reviewboard/cmdline/conf/cron.conf.in
    
    
  2. 
      
chipx86
  1. 
      
  2. reviewboard/cmdline/conf/cron.conf.in (Diff revision 3)
     
     
    Show all issues

    Maybe do this at a different time from the rebuild_index, so we don't swamp the database.

    (Do we need to do rebuild_index at all anymore, actually?)

  3. 
      
david
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/cmdline/rbsite.py
    
    Ignored Files:
        reviewboard/cmdline/conf/cron.conf.in
        reviewboard/cmdline/conf/search-cron.conf.in
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/cmdline/rbsite.py
    
    Ignored Files:
        reviewboard/cmdline/conf/cron.conf.in
        reviewboard/cmdline/conf/search-cron.conf.in
    
    
  2. 
      
chipx86
  1. Ship It!

  2. 
      
david
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.0.x (8c41e45)