Edgewall Software
Modify

Ticket #7204 (closed defect: duplicate)

Opened 4 years ago

Last modified 3 years ago

Config loader should die on error

Reported by: nkantrowitz Owned by: jonas
Priority: normal Milestone:
Component: general Version: 0.12dev
Severity: normal Keywords:
Cc: nkantrowitz
Release Notes:
API 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

Change History

comment:1 Changed 4 years ago by Kamil Kisiel <kamil@…>

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

dchrome?.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.

comment:2 Changed 3 years ago by osimons

  • Milestone 0.13 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

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

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
to The owner will be changed from jonas. Next status will be 'closed'
Author


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

 
Note: See TracTickets for help on using tickets.