Edgewall Software
Modify

Opened 16 years ago

Closed 15 years ago

Last modified 10 years ago

#7204 closed defect (duplicate)

Config loader should die on error

Reported by: Noah Kantrowitz Owned by: Jonas Borgström
Priority: normal Milestone:
Component: general Version: 0.12dev
Severity: normal Keywords:
Cc: Noah Kantrowitz Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Configuration.parse_if_needed should die if self.parser.read(self.filename) returns [] as this indicates it wasn't able to read the file. This generally happens either if a permission error prevents trac.ini from being read, or if the path to a parent config is invalid. A more helpful error message is desirable in either case.

Attachments (0)

Change History (2)

comment:1 by Kamil Kisiel <kamil@…>, 16 years ago

We discovered this as a result of me attempting to configure Trac under FastCGI. Instead of an error related to being unable to read the trac.ini I got this:

Traceback (most recent call last):
  File "/usr/lib64/python2.5/site-packages/trac/web/api.py", line 339, in send_error
    'text/html')
  File "/usr/lib64/python2.5/site-packages/trac/web/chrome.py", line 684, in render_template
    data = self.populate_data(req, data)
  File "/usr/lib64/python2.5/site-packages/trac/web/chrome.py", line 592, in populate_data
    d['chrome'].update(req.chrome)
  File "/usr/lib64/python2.5/site-packages/trac/web/api.py", line 168, in __getattr__
    value = self.callbacks[name](self)
  File "/usr/lib64/python2.5/site-packages/trac/web/chrome.py", line 460, in prepare_request
    for category, name, text in contributor.get_navigation_items(req):
  File "/usr/lib64/python2.5/site-packages/trac/ticket/web_ui.py", line 134, in get_navigation_items
    if 'TICKET_CREATE' in req.perm:
  File "/usr/lib64/python2.5/site-packages/trac/perm.py", line 521, in has_permission
    return self._has_permission(action, resource)
  File "/usr/lib64/python2.5/site-packages/trac/perm.py", line 535, in _has_permission
    check_permission(action, perm.username, resource, perm)
  File "/usr/lib64/python2.5/site-packages/trac/perm.py", line 424, in check_permission
    perm)
  File "/usr/lib64/python2.5/site-packages/trac/perm.py", line 282, in check_permission
    get_user_permissions(username)
  File "/usr/lib64/python2.5/site-packages/trac/perm.py", line 357, in get_user_permissions
    for perm in self.store.get_user_permissions(username):
  File "/usr/lib64/python2.5/site-packages/trac/perm.py", line 173, in get_user_permissions
    db = self.env.get_db_cnx()
  File "/usr/lib64/python2.5/site-packages/trac/env.py", line 251, in get_db_cnx
    return DatabaseManager(self).get_connection()
  File "/usr/lib64/python2.5/site-packages/trac/db/api.py", line 76, in get_connection
    return self._cnx_pool.get_cnx(self.timeout or None)
  File "/usr/lib64/python2.5/site-packages/trac/db/pool.py", line 101, in get_cnx
    cnx = self._connector.get_connection(**self._kwargs)
  File "/usr/lib64/python2.5/site-packages/trac/db/sqlite_backend.py", line 125, in get_connection
    return SQLiteConnection(path, params)
  File "/usr/lib64/python2.5/site-packages/trac/db/sqlite_backend.py", line 167, in __init__
    % (getuser(), path))
TracError: The user apache requires read _and_ write permission to the database file /var/lib/trac/db/trac.db and the directory it is located in.

The confusing part about it was that it was attempting to use an sqlite database, whereas my DB is PostgreSQL. Trac should have died earlier in the process when it could not read the config file, instead of continuing and attempting to load the defaults.

Last edited 10 years ago by Jun Omae (previous) (diff)

comment:2 by osimons, 15 years ago

Milestone: 0.13
Resolution: duplicate
Status: newclosed

Closing this as a duplicate of the issue (and discussion) in #5535.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jonas Borgström.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jonas Borgström to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.