Hi,

I set up a brand new Autotest instance following:
http://autotest.kernel.org/wiki/AutotestServerInstall

So far so good. All that was causing a problem was a NULL pointer in the 
Debian squeeze python-matplotlib package. Compiling it by hand works. 
Anyhow, that's a different story.

My problem:

Adding a new acl group using the Django Admin interface
http://host/afe/server/admin/afe/aclgroup/add/
retruns a Django error page.

*************************************************************
OperationalError at /afe/server/admin/afe/aclgroup/add/

(1054, "Unknown column 'afe_acl_groups_users.id' in 'field list'")

Request Method:         POST
Request URL:    http://localhost/afe/server/admin/afe/aclgroup/add/
Django Version:         1.3
Exception Type:         OperationalError
Exception Value:        

(1054, "Unknown column 'afe_acl_groups_users.id' in 'field list'")

Exception Location:     /usr/lib/pymodules/python2.6/MySQLdb/connections.py 
in defaulterrorhandler, line 35
*************************************************************


Here what I did:

I added the following to frontend/settings.py

*************************************************************
if DEBUG:
     import traceback
     import logging

     # Define a class that logs unhandled errors
     class LogUncatchedErrors:
         def process_exception(self, request, exception):
             logging.error("Unhandled Exception on request for %s\n%s" %
                                  (request.build_absolute_uri(),
                                   traceback.format_exc()))
     # And add it to the middleware classes
     MIDDLEWARE_CLASSES += ('settings.LogUncatchedErrors',)

     # set shown level of logging output to debug
     logging.basicConfig(level=logging.DEBUG)
*************************************************************

which gives a stack trace and the SQL.
The SQL states among other statements:
DEBUG:django.db.backends:(0.000) SELECT `afe_acl_groups_hosts`.`id`, 
`afe_acl_groups_hosts`.`aclgroup_id`, `afe_acl_groups_hosts`.`host_id` 
FROM `afe_acl_groups_hosts` WHERE (`afe_acl_groups_hosts`.`aclgroup_id` 
= 1  AND `afe_acl_groups_hosts`.`host_id` IN (1, 2)) LIMIT 21; args=(1, 
1, 2)

The afe_acl_groups_hosts is a Django ORM ManyToManyField "link-table". 
It doesn't have an 'id' column. Doesn't need one of course. Anyhow, that 
makes me feel like it's a Django bug. But reading the comment in
autotest/frontend/afe/models.py:673
669 @staticmethod
670  def on_host_membership_change():
671     everyone = AclGroup.objects.get(name='Everyone')
672
673     # find hosts that aren't in any ACL group and add them to Everyone
674     # TODO(showard): this is a bit of a hack, since the fact that 
this query
675     # works is kind of a coincidence of Django internals.  This trick
676     # doesn't work in general (on all foreign key relationships).  I'll
677     # replace it with a better technique when the need arises.

doesn't give me a good feeling. BTW, skipping this function works around 
the described bug in the python manage.py shell, e. g. the following now 
works:
In [1]: from afe.models import *
In [2]: acl = AclGroup(name="Shell1")
In [3]: acl.save()
In [4]: acl.users.add(User.objects.get(id=2))
In [5]: acl.hosts.add(Host.objects.get(id=2))
In [6]: acl.save()

However, using the Django Admin raises the same exception as before.

Even knowing Django a little I'm stuck with this bug.

Has anyone an idea what's wrong here? If not, I'll spend more hours in 
the dark. Maybe s/o has at least a hint.


Thanks,

        Frank

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to