Edgewall Software
Modify

Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#8283 closed defect (fixed)

Postgres backup does not work if no user explicitely configured

Reported by: Felix Schwarz <felix.schwarz@…> Owned by: Felix Schwarz <felix.schwarz@…>
Priority: normal Milestone: 0.11.5
Component: general Version: 0.11-stable
Severity: normal Keywords: backup
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

With trac 0.11dev (r8197) the postgres backup function does not work if there was no user configured in the db string (e.g. 'postgres://localhost/foo'): branches/0.11-stable/trac/db/postgres_backend.py@8197#L111

Traceback (most recent call last):
  File "trac-admin", line 8, in <module>
    load_entry_point('Trac==0.11.5stable-r8080', 'console_scripts', 'trac-admin')()
  File "/trac/admin/console.py", line 1317, in run
    return admin.onecmd(command)
  File "/trac/admin/console.py", line 133, in onecmd
    rv = cmd.Cmd.onecmd(self, line) or 0
  File "/usr/lib64/python2.5/cmd.py", line 219, in onecmd
    return func(arg)
  File "/trac/admin/console.py", line 1154, in do_upgrade
    self.__env.upgrade(backup=do_backup)
  File "/trac/env.py", line 455, in upgrade
    self.backup(backup_dest)
  File "/trac/env.py", line 423, in backup
    return DatabaseManager(self).backup(dest)
  File "/trac/db/api.py", line 110, in backup
    return connector.backup(dest)
  File "/trac/db/postgres_backend.py", line 111, in backup
    '-U', db_prop['user'],]
KeyError: 'user'

Just from looking at the source code, I suspect that MySQL will have the same problem: branches/0.11-stable/trac/db/mysql_backend.py@8197#L157

Attachments (1)

postgres_backend_does_not_assume_user_is_set_8283 (679 bytes ) - added by Felix Schwarz <felix.schwarz@…> 15 years ago.
Patch for that issue

Download all attachments as: .zip

Change History (6)

comment:1 by Christian Boos, 15 years ago

Keywords: backup added
Milestone: 0.11.5

Thanks for the report!

Patch appreciated (should be easy, doing the same kind of check as for the 'port' in the MySQL version).

by Felix Schwarz <felix.schwarz@…>, 15 years ago

Patch for that issue

comment:2 by Christian Boos, 15 years ago

Milestone: 0.11.60.11.5

comment:3 by Remy Blank, 15 years ago

Owner: set to Remy Blank

Working on this.

comment:4 by Remy Blank, 15 years ago

Resolution: fixed
Status: newclosed

The fix has been committed in [8312], along with some cleanup. I have applied the same fix for MySQL, but testing shows that it's not possible to connect to a MySQL database without setting a user.

Thanks Felix!

comment:5 by Remy Blank, 15 years ago

Owner: changed from Remy Blank to Felix Schwarz <felix.schwarz@…>

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Felix Schwarz <felix.schwarz@…>.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Felix Schwarz <felix.schwarz@…> 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.