Modify

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#8774 closed defect (fixed)

KeyError: acct_mgr.web_ui after failed import of acct_mgr.web_ui

Reported by: andhos@… Owned by: hasienda
Priority: normal Component: AccountManagerPlugin
Severity: blocker Keywords: regression
Cc: Trac Release: 0.12

Description

This happens in Trac 0.12.2
After installing AccountManager Plugin this error appears when I navigate to the plugins page in the admin or if I enable the acct_mgr.web_ui.LoginModule.

KeyError: acct_mgr.web_ui

Attachments (0)

Change History (9)

comment:1 Changed 3 years ago by hasienda

  • Keywords needinfo added

Certainly you did comply to the explicit advice for configuration and disabled Trac's own web login page, didn't you?

[components]
acct_mgr.web_ui.LoginModule = enabled

trac.web.auth.LoginModule = disabled

What version of AcctMgr did you (try to) install exactly? Where did you take the error message from, the browser window, a error message box, trac.log, ...? I'll need something more to reproduce, if it's not an installation and configuration issue at your side.

comment:2 Changed 3 years ago by andhos@…

Trac: fresh install of 0.12.2, in a virtualenv with --no-site-packages setup with apache and mod_wgsi.
AccountManagerPlugin: trunk version.

Scenario 1

  • Installed the plugin but not enabled anywhere
  • Everything works fine in normal pages
  • When navigating to the plugin page in web admin
  • Error appears in plugin page

Scenario 2

  • Installed the plugin and enabled the plugin in trac.ini
  • Yes, trac.web.auth.LoginModule was disabled
  • Error appears in all pages

Error is found in /var/log/apache2/trac-error.log which I setup to log trac errors according to this guide.

I will post a trac log as soon as possible.

comment:3 Changed 3 years ago by anonymous

Same situation here, fresh Trac 0.12.2 install.

comment:4 Changed 3 years ago by andhos@…

Okay, here is the Trac Exception:

----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 42866)
Traceback (most recent call last):
  File "/usr/lib/python2.7/SocketServer.py", line 582, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python2.7/SocketServer.py", line 323, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python2.7/SocketServer.py", line 639, in __init__
    self.handle()
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 343, in handle
    self.handle_one_request()
  File "/home/likewise-open/ALLIEDINSURE/amjad/tracenv/lib/python2.7/site-packages/Trac-0.12.2-py2.7.egg/trac/web/wsgi.py", line 189, in handle_one_request
    gateway.run(self.server.application)
  File "/home/likewise-open/ALLIEDINSURE/amjad/tracenv/lib/python2.7/site-packages/Trac-0.12.2-py2.7.egg/trac/web/wsgi.py", line 89, in run
    response = application(self.environ, self._start_response)
  File "/home/likewise-open/ALLIEDINSURE/amjad/tracenv/lib/python2.7/site-packages/Trac-0.12.2-py2.7.egg/trac/web/standalone.py", line 90, in __call__
    return self.application(environ, start_response)
  File "/home/likewise-open/ALLIEDINSURE/amjad/tracenv/lib/python2.7/site-packages/Trac-0.12.2-py2.7.egg/trac/web/main.py", line 479, in dispatch_request
    return _dispatch_request(req, env, env_error)
  File "/home/likewise-open/ALLIEDINSURE/amjad/tracenv/lib/python2.7/site-packages/Trac-0.12.2-py2.7.egg/trac/web/main.py", line 555, in _dispatch_request
    send_internal_error(env, req, sys.exc_info())
  File "/home/likewise-open/ALLIEDINSURE/amjad/tracenv/lib/python2.7/site-packages/Trac-0.12.2-py2.7.egg/trac/web/main.py", line 579, in send_internal_error
    plugins = [p for p in get_plugin_info(env)
  File "/home/likewise-open/ALLIEDINSURE/amjad/tracenv/lib/python2.7/site-packages/Trac-0.12.2-py2.7.egg/trac/loader.py", line 141, in get_plugin_info
    module = sys.modules[component.__module__]
KeyError: 'acct_mgr.web_ui'
----------------------------------------

I just did a new install,
Ubuntu 11.04, linux kernel 2.6.38-8-generic x86_64
Python 2.7.1+
Babel 0.9.5
Trac 0.12.2
AccountManagerPlugin trunk

These are my exact commands:
:~$ virtualenv --no-site-packages ~/tracenv
:~$ source ~/tracenv/bin/activate
(tracenv):~$ easy_install Babel==0.9.5
(tracenv):~$ easy_install Trac
(tracenv):~$ mkdir ~/trac
(tracenv):~$ trac-admin ~/trac/test
(tracenv):~$ tracd --port 8000 ~/trac/test # test, it works
(tracenv):~$ easy_install https://trac-hacks.org/svn/accountmanagerplugin/trunk
(tracenv):~$ tracd --port 8000 ~/trac/test # test, plugin page doesn't work

I haven't tried after enabling the plugin but I'm pretty sure the same will happen just like last time.

I am also going to test with python 2.6 a little later.
Thanks

comment:5 Changed 3 years ago by andhos@…

Sorry about the previous post, here are the commands correctly formatted.

These are my exact commands:

:~$ virtualenv --no-site-packages ~/tracenv
:~$ source ~/tracenv/bin/activate
(tracenv):~$ easy_install Babel==0.9.5
(tracenv):~$ easy_install Trac
(tracenv):~$ mkdir ~/trac
(tracenv):~$ trac-admin ~/trac/test
(tracenv):~$ tracd --port 8000 ~/trac/test # test, it works
(tracenv):~$ easy_install https://trac-hacks.org/svn/accountmanagerplugin/trunk
(tracenv):~$ tracd --port 8000 ~/trac/test # test, plugin page doesn't work

comment:6 Changed 3 years ago by hasienda

  • Keywords regression added; needinfo removed
  • Severity changed from normal to blocker
  • Status changed from new to assigned
  • Summary changed from KeyError: acct_mgr.web_ui to KeyError: acct_mgr.web_ui after failed import of acct_mgr.web_ui

Ok, silly me. This is a regression caused by the config.get* calls introduced in changeset [10169].

Your quote from log file was just a result of failed import of acct_mgr.web_ui module. Lessons learned:

  1. Do (better) testing of any change, how trivial it might ever look.
  2. Check beginning with
    -------------------------------- environment startup [Trac 0.13dev] --------------------------------
    

Sorry, this will be fixed in a few minutes. I leave it up to you to close this ticket, if you can confirm that the issue is really fixed for you too.

comment:7 Changed 3 years ago by hasienda

(In [10176]) AccountManagerPlugin: Fix reading of configuration in LoginModule, refs #8774.

This is a rework of changeset [10169] which added some reportedly broken code.
Now we use module variables instead of that defined on class level. This
should even work with Trac < 0.12, where the requested values are not defined.

comment:8 Changed 3 years ago by andhos@…

  • Resolution set to fixed
  • Status changed from assigned to closed

I have updated and checked that it indeed works.

Thank you very much.

comment:9 Changed 3 years ago by hasienda

Glad to hear that. Thank you for taking care by instant report and testing the fix.

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.