fix a traceback in rb-site install with 1.7.7

Review Request #4074 — Created April 21, 2013 and submitted

Information

Review Board
master

Reviewers

Fix a major (and simple) bug in the 1.7.7 release. When you don't specify the webserver port, it is passed in as an integer to rb-site, which blows up horribly as the re.sub expects a string. Example traceback:

* Installing the site...
Building site directories ... OK
Building site configuration files ... Traceback (most recent call last):
  File "/home/venvs/bin/rb-site", line 8, in <module>
    load_entry_point('ReviewBoard==1.7.7', 'console_scripts', 'rb-site')()
  File "/home/venvs/lib/python2.7/site-packages/ReviewBoard-1.7.7-py2.7.egg/reviewboard/cmdline/rbsite.py", line 1937, in main
    command.run()
  File "/home/venvs/lib/python2.7/site-packages/ReviewBoard-1.7.7-py2.7.egg/reviewboard/cmdline/rbsite.py", line 1405, in run
    self.show_install_status()
  File "/home/venvs/lib/python2.7/site-packages/ReviewBoard-1.7.7-py2.7.egg/reviewboard/cmdline/rbsite.py", line 1682, in show_install_status
    site.generate_config_files)
  File "/home/venvs/lib/python2.7/site-packages/ReviewBoard-1.7.7-py2.7.egg/reviewboard/cmdline/rbsite.py", line 885, in step
    func()
  File "/home/venvs/lib/python2.7/site-packages/ReviewBoard-1.7.7-py2.7.egg/reviewboard/cmdline/rbsite.py", line 290, in generate_config_files
    os.path.join(conf_dir, web_conf_filename))
  File "/home/venvs/lib/python2.7/site-packages/ReviewBoard-1.7.7-py2.7.egg/reviewboard/cmdline/rbsite.py", line 626, in process_template
    template)
  File "/home/venvs/lib/python2.7/re.py", line 151, in sub
    return _compile(pattern, flags).sub(repl, string, count)
TypeError: sequence item 1: expected string, int found

I was running rb-site install via:

rb-site install \
  --copy-media \
  --noinput \
  --domain-name="${vhost}.${domain}" \
  --site-root=/ \
  --static-url=static/ \
  --media-url=media/ \
  --db-type=mysql \
  --db-name="$database" \
  --db-host=localhost \
  --db-user="$team" \
  --db-pass="$password" \
  --cache-type=memcached \
  --cache-info="localhost:11211" \
  --web-server-type=apache \
  --python-loader=wsgi \
"${basedir}/$vhost"
Ran rb-site install post-patch and it works as expected.
reviewbot
  1. This is a review from Review Bot.
      Tool: PEP8 Style Checker
      Processed Files:
        reviewboard/cmdline/rbsite.py
      Ignored Files:
    
    
  2. 
      
chipx86
  1. Thanks for the fix. The right thing to do though is to change the default to be a string. I'll go ahead and make that change and get a 1.7.7.1 out.
    
    I don't understand the site_id part. At no point does this appear to be an integer. Can you clarify for me?
    1. I was just making sure that there was no way for it to be an int either. Just found quick fix so I could upgrade and thought I'd sling the patch back your way. 1.7.7 makes it MUCH easier to work with virtualenvs so thanks
    2. Cool, thanks. Well I should have a release out for you within a couple hours.
  2. 
      
SE
Review request changed
Status:
Completed