1005: Problem Upgrading from Alpha 4 to Beta 2

mda***@efficienc********* (Google Code) (Is this you? Claim this profile.)
March 31, 2009
I am running CentOS 5.2 with a MySQL 5 database.  I tried updating from
alpha 4 to beta 2 and when I run rb-site upgrade I get the error below when
it tries to update the database.  I also get the global name 's' not
defined in all reviews new or made before the upgrade.

What's the URL of the page containing the problem?
Any Review Page

What is the expected output? What do you see instead?


rb-site upgrade <correct path here>
Rebuilding directory structure
Updating database
Traceback (most recent call last):
  File "/usr/bin/rb-site", line 5, in ?
    pkg_resources.run_script('ReviewBoard==1.0beta2', 'rb-site')
  File
"/usr/lib/python2.4/site-packages/setuptools-0.6c9-py2.4.egg/pkg_resources.py",
line 448, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File
"/usr/lib/python2.4/site-packages/setuptools-0.6c9-py2.4.egg/pkg_resources.py",
line 1166, in run_script
    execfile(script_filename, namespace, namespace)
  File
"/usr/lib/python2.4/site-packages/ReviewBoard-1.0beta2-py2.4.egg/EGG-INFO/scripts/rb-site",
line 1280, in ?
    main(sys.argv[1:])
  File
"/usr/lib/python2.4/site-packages/ReviewBoard-1.0beta2-py2.4.egg/EGG-INFO/scripts/rb-site",
line 1275, in main
    command.run()
  File
"/usr/lib/python2.4/site-packages/ReviewBoard-1.0beta2-py2.4.egg/EGG-INFO/scripts/rb-site",
line 1196, in run
    site.sync_database()
  File
"/usr/lib/python2.4/site-packages/ReviewBoard-1.0beta2-py2.4.egg/EGG-INFO/scripts/rb-site",
line 224, in sync_database
    self.run_manage_command("syncdb", ["--noinput"])
  File
"/usr/lib/python2.4/site-packages/ReviewBoard-1.0beta2-py2.4.egg/EGG-INFO/scripts/rb-site",
line 262, in run_manage_command
    execute_manager(reviewboard.settings, [__file__, cmd] + params)
  File
"/usr/lib/python2.4/site-packages/Django-1.0.2_final-py2.4.egg/django/core/management/__init__.py",
line 340, in execute_manager
    utility.execute()
  File
"/usr/lib/python2.4/site-packages/Django-1.0.2_final-py2.4.egg/django/core/management/__init__.py",
line 295, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File
"/usr/lib/python2.4/site-packages/Django-1.0.2_final-py2.4.egg/django/core/management/base.py",
line 192, in run_from_argv
    self.execute(*args, **options.__dict__)
  File
"/usr/lib/python2.4/site-packages/Django-1.0.2_final-py2.4.egg/django/core/management/base.py",
line 219, in execute
    output = self.handle(*args, **options)
  File
"/usr/lib/python2.4/site-packages/Django-1.0.2_final-py2.4.egg/django/core/management/base.py",
line 348, in handle
    return self.handle_noargs(**options)
  File
"/usr/lib/python2.4/site-packages/Django-1.0.2_final-py2.4.egg/django/core/management/commands/syncdb.py",
line 101, in handle_noargs
    emit_post_sync_signal(created_models, verbosity, interactive)
  File
"/usr/lib/python2.4/site-packages/Django-1.0.2_final-py2.4.egg/django/core/management/sql.py",
line 205, in emit_post_sync_signal
    interactive=interactive)
  File
"/usr/lib/python2.4/site-packages/Django-1.0.2_final-py2.4.egg/django/dispatch/dispatcher.py",
line 148, in send
    response = receiver(signal=self, sender=sender, **named)
  File
"/usr/lib/python2.4/site-packages/ReviewBoard-1.0beta2-py2.4.egg/reviewboard/admin/management/sites.py",
line 24, in init_siteconfig
    siteconfig, is_new = SiteConfiguration.objects.get_or_create(site=site)
  File
"/usr/lib/python2.4/site-packages/Django-1.0.2_final-py2.4.egg/django/db/models/manager.py",
line 96, in get_or_create
    return self.get_query_set().get_or_create(**kwargs)
  File
"/usr/lib/python2.4/site-packages/Django-1.0.2_final-py2.4.egg/django/db/models/query.py",
line 332, in get_or_create
    return self.get(**kwargs), False
  File
"/usr/lib/python2.4/site-packages/Django-1.0.2_final-py2.4.egg/django/db/models/query.py",
line 304, in get
    num = len(clone)
  File
"/usr/lib/python2.4/site-packages/Django-1.0.2_final-py2.4.egg/django/db/models/query.py",
line 160, in __len__
    self._result_cache = list(self.iterator())
  File
"/usr/lib/python2.4/site-packages/Django-1.0.2_final-py2.4.egg/django/db/models/query.py",
line 280, in iterator
    obj = self.model(*row[index_start:])
  File
"/usr/lib/python2.4/site-packages/Djblets-0.5beta1-py2.4.egg/djblets/siteconfig/models.py",
line 54, in __init__
    models.Model.__init__(self, *args, **kwargs)
  File
"/usr/lib/python2.4/site-packages/Django-1.0.2_final-py2.4.egg/django/db/models/base.py",
line 266, in __init__
    signals.post_init.send(sender=self.__class__, instance=self)
  File
"/usr/lib/python2.4/site-packages/Django-1.0.2_final-py2.4.egg/django/dispatch/dispatcher.py",
line 148, in send
    response = receiver(signal=self, sender=sender, **named)
  File
"/usr/lib/python2.4/site-packages/Djblets-0.5beta1-py2.4.egg/djblets/util/fields.py",
line 174, in post_init
    value = self.loads(value)
  File
"/usr/lib/python2.4/site-packages/Djblets-0.5beta1-py2.4.egg/djblets/util/fields.py",
line 199, in loads
    logging.warning("JSONField decode error. Expected dictionary, "
NameError: global name 's' is not defined


What operating system are you using? What browser?
Centos 5.2

Please provide any additional information below.
Mysql 5 Database
#1 mda***@efficienc********* (Google Code) (Is this you? Claim this profile.)
Forgot to add this is under x64 CentOS.  
chipx86
#2 chipx86
The NameError is definitely a silly side-effect bug in Djblets, but the cause of your
problem is a bit more complex.

Can you run the following and paste the exact contents (though feel free to mask out
any sensitive info, if any):

$ rb-site manage /path/to/your/site shell
>>> from djblets.siteconfig.models import SiteConfiguration
>>> SiteConfiguration.objects.all().values()

That *should* dump a bunch of data out that we can use to determine what messed up in
your siteconfig settings. We should then be able to work around it.
  • +NeedInfo
#3 mda***@efficienc********* (Google Code) (Is this you? Claim this profile.)
[{'version': u'1.0alpha4', 'site_id': 1L, 'id': 1L, 'settings': 
u'"{u\'mail_host_password\': u\'\', u\'cache_backend\': 
u\'memcached://localhost:11211/\', u\'site_upload_temp_dir\': None, 
u\'locale_datetime_format\': u\'N j, Y, P\', u\'auth_ldap_tls\': False, 
u\'mail_host_user\': u\'\', u\'auth_ad_use_tls\': False, 
u\'locale_year_month_format\': u\'F Y\', u\'auth_ldap_uid_mask\': u\'uid=%
s,ou=users,dc=example,dc=com\', u\'mail_server_address\': u\'root@localhost\', 
u\'auth_ldap_uri\': u\'\', u\'auth_ldap_anon_bind_uid\': u\'\', 
u\'diffviewer_context_num_lines\': 5, u\'diffviewer_paginate_orphans\': 10, 
u\'mail_send_review_mail\': True, u\'site_media_root\': 
u\'/**/codereview/htdocs/media\', u\'locale_language_code\': u\'en-us\', 
u\'auth_nis_email_domain\': u\'\', u\'logging_allow_profiling\': False, 
u\'auth_ldap_anon_bind_passwd\': u\'\', u\'cache_expiration_time\': 2592000, 
u\'site_prepend_www\': False, u\'search_index_file\': u\'\', u\'auth_ldap_base_dn\': 
u\'\', u\'mail_port\': 25, u\'logging_directory\': None, u\'search_enable\': False, 
u\'locale_time_format\': u\'P\', u\'locale_date_format\': u\'N j, Y\', 
u\'auth_ldap_email_domain\': u\'\', u\'locale_month_day_format\': u\'F j\', 
u\'auth_ldap_email_attribute\': u\'\', u\'auth_custom_backends\': [u\'\'], 
u\'diffviewer_syntax_highlighting\': True, u\'auth_ad_ou_name\': u\'\', 
u\'mail_use_tls\': False, u\'site_admin_email\': u\'**@**.com\', u\'auth_backend\': 
u\'builtin\', u\'locale_timezone\': u\'US/Pacific\', u\'auth_ad_domain_controller\': 
u\'\', u\'site_domain_method\': u\'https\', u\'auth_ad_find_dc_from_dns\': False, 
u\'diffviewer_paginate_by\': 20, u\'logging_enabled\': False, u\'locale_time_zone\': 
u\'US/Pacific\', u\'auth_require_sitewide_login\': True, 
u\'site_upload_max_memory_size\': 10485760, u\'locale_default_charset\': u\'utf-8\', 
u\'auth_ad_domain_name\': u\'\', u\'auth_ad_recursion_depth\': None, u\'mail_host\': 
u\'localhost\', u\'diffviewer_include_space_patterns\': [], u\'mail_default_from\': 
u\'webmaster@localhost\', u\'site_media_url\': u\'/codereview/media/\', 
u\'site_admin_name\': u\'Admin\', u\'auth_ad_group_name\': u\'\'}"'}]
chipx86
#4 chipx86
Sounds like the best bet is to modify this entry in your database by hand, either
setting the settings field to an empty string (which will wipe out your settings,
mean you'll need to go back and set up auth and stuff again).

Are you still able to log in to your admin UI at all?

The key thing breaking this is the u'..' stuff around everything.
#5 mda***@efficienc********* (Google Code) (Is this you? Claim this profile.)
I can log into the admin UI and move around to everything except Settings and Site 
Configurations.  

Anyways I did some work and got it working with these steps:
  1. I went into the Mysql and changed the id number on that entry.  
  2. rb-site upgrade created a new default settings entry.  
  3. I combined the 2 so I had the settings of the old one in the formatting in the 
     new one.  
  4  I changed the ID back to 1.  
  5  I redid the rb-site update 
  6  After some changing of null to None, false to False, and true to True, it went
     through and is now working.  

My only question is I looked in the site settings in the Admin panel all the u'..' 
are back, but when I look at the database entry it says "...".  Is that correct or 
should they be the same?
chipx86
#6 chipx86
Not sure what you mean by it saying "...". You mean without the "u" part?

That would be correct. In the database, we're seeing a Python serialized version of
the keys, which would show "u" since those are Unicode strings. When writing it out
to the database, though, we encode properly so that we don't end up with "u".

There were some bugs in earlier versions (possibly alpha 4) in serializing this data.
It *should* work a lot better now, but unfortunately it's hard to migrate the broken
data.

Please let me know if this happens to you again. Glad it's working now.
  • -NeedInfo
    +Fixed
  • +Component-Settings
    +Djblets