Modify

Opened 2 years ago

Closed 2 years ago

#10230 closed defect (duplicate)

`trac-admin ... upgrade` boken on trac v1.0

Reported by: anonymous Owned by: doki_pen
Priority: normal Component: AnnouncerPlugin
Severity: critical Keywords:
Cc: Trac Release: 1.0

Description

When installing the current branch/0.12 release on a trac v1.0 installation the DB upgrade does not work. When executing trac-admin [path] upgrade it simply exits with following output:

$ trac-admin [path] upgrade
AttributeError:

Logfile:

Trac[console] ERROR: Exception in trac-admin command: 
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/Trac-1.0dev_r11163-py2.6.egg/trac/admin/console.py", line 107, in onecmd
    rv = cmd.Cmd.onecmd(self, line) or 0
  File "/usr/lib/python2.6/cmd.py", line 218, in onecmd
    return self.default(line)
  File "/usr/local/lib/python2.6/dist-packages/Trac-1.0dev_r11163-py2.6.egg/trac/admin/console.py", line 275, in default
    return cmd_mgr.execute_command(*args)
  File "/usr/local/lib/python2.6/dist-packages/Trac-1.0dev_r11163-py2.6.egg/trac/admin/api.py", line 123, in execute_command
    return f(*fargs)
  File "/usr/local/lib/python2.6/dist-packages/Trac-1.0dev_r11163-py2.6.egg/trac/env.py", line 947, in _do_upgrade
    if not self.env.needs_upgrade():
  File "/usr/local/lib/python2.6/dist-packages/Trac-1.0dev_r11163-py2.6.egg/trac/env.py", line 655, in needs_upgrade
    if participant.environment_needs_upgrade(db):
  File "/usr/local/lib/python2.6/dist-packages/TracAnnouncer-0.12.1dev-py2.6.egg/announcer/api.py", line 493, in environment_needs_upgrade
    db.rollback()
  File "/usr/local/lib/python2.6/dist-packages/Trac-1.0dev_r11163-py2.6.egg/trac/db/util.py", line 107, in __getattr__
    raise AttributeError
AttributeError: 

Work around:
in file /usr/local/lib/python2.6/dist-packages/TracAnnouncer-0.12.1dev-py2.6.egg/announcer/api.py around line 493. change method to look like:

    def environment_needs_upgrade(self, db):
        cursor = db.cursor()
        for table in self.SCHEMA:
            try:
                cursor.execute("select count(*) from %s"%table.name)
                cursor.fetchone()
            except:
                if not db.readonly:   # added this line!
                    db.rollback()
                return True
        return False

Thanks for the plugin allthough I am right now starting to have a closer look at it .)

Attachments (0)

Change History (2)

comment:1 Changed 2 years ago by seccanj

See comment on #10293.

comment:2 Changed 2 years ago by rjollos

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #9742.

Add Comment

Modify Ticket

Action
as closed The owner will remain doki_pen.
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.