Edgewall Software
Modify

Opened 17 years ago

Closed 17 years ago

#6205 closed defect (worksforme)

can't upgrade a environment

Reported by: Cho Owned by: Christopher Lenz
Priority: high Milestone:
Component: admin/console Version:
Severity: major Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

After creating a Trac environment,it can not upgrade a environment.It shows as follows: tp7: error (The Trac Environment needs to be upgraded. Run trac-admin /home/svnroot/trac/tp7 upgrade")

in the linux The error shows: [root@test56 conf]# trac-admin /home/svnroot/trac/tp7 upgrade Command failed: an integer is required

Attachments (0)

Change History (6)

comment:1 by Christian Boos, 17 years ago

Most likely a plugin error, which unfortunately gets hidden in 0.10.4, which I think you're using…

You can modify your trac/scripts/admin.py file that way:

  • admin.py

     
    9898            raise
    9999        except Exception, e:
    100100            print>>sys.stderr, 'Command failed: %s' % e
     101            raise
    101102            rv = 2
    102103        if not self.interactive:
    103104            return rv

to see the backtrace and find the plugin involved (or, more unlikely, an issue within Trac error).

Please close as worksforme or wontfix if it's a plugin and not Trac which is concerned.

in reply to:  1 comment:2 by Cho, 17 years ago

Hello,cboos, when I modify the main.py as you said.But unfortunately,it can't work.It shows:

[root@test56 trac]# trac-admin /home/svnroot/trac/tp7 upgrade Command failed: an integer is required Traceback (most recent call last):

File "/usr/bin/trac-admin", line 22, in ?

sys.exit(run(sys.argv[1:]))

File "/usr/lib/python2.4/site-packages/trac/scripts/admin.py", line 1230, in run

return admin.onecmd(command)

File "/usr/lib/python2.4/site-packages/trac/scripts/admin.py", line 96, in onecmd

rv = cmd.Cmd.onecmd(self, line) or 0

File "/usr/lib/python2.4/cmd.py", line 219, in onecmd

return func(arg)

File "/usr/lib/python2.4/site-packages/trac/scripts/admin.py", line 1143, in do_upgrade

self.env.upgrade(backup=do_backup)

File "/usr/lib/python2.4/site-packages/trac/env.py", line 369, in upgrade

self.backup(backup_dest)

File "/usr/lib/python2.4/site-packages/trac/env.py", line 336, in backup

dest = '%s.%i.bak' % (db_name, self.get_version())

TypeError: an integer is required

comment:3 by Christian Boos, 17 years ago

Keywords: needinfo added

Cho, the purpose of that change was to show to backtrace and that obviously worked ;-)

Now, can you access the Trac database directly and execute the following SQL query?

SELECT value FROM system WHERE name='database_version'

What does this give you back?

Note: if you're using SQLite for your DatabaseBackend, then your db file is in located in /home/svnroot/trac/tp7/db/trac.db, and you can open it using sqlite trac.db if you're using SQLite 2 or sqlite3 trac.db if you're using SQLite 3.

comment:4 by led_belly, 17 years ago

I'm experiencing the same problem on a FreeBSD 6 box with trac 0.10 installed from ports. I don't know sqli

sqlite> SELECT value FROM system WHERE name='database_version'; sqlite> .schema system; sqlite> .databases seq name file —- ———————- ————————————————————————————— 0 main /home/led_belly/trac.gotapex.com/db/./trac.db 1 temp sqlite> .tables attachment node_change session_attribute version auth_cookie permission system wiki component report ticket enum revision ticket_change milestone session ticket_custom sqlite>

comment:5 by anonymous, 17 years ago

sorry… should have previewed first

sqlite> SELECT value FROM system WHERE name='database_version';
sqlite> .schema system;
sqlite> .databases
seq  name             file                                                      
---  ---------------  ----------------------------------------------------------
0    main             /home/led_belly/trac.gotapex.com/db/./trac.db             
1    temp                                                                       
sqlite> .tables
attachment         node_change        session_attribute  version          
auth_cookie        permission         system             wiki             
component          report             ticket           
enum               revision           ticket_change    
milestone          session            ticket_custom    
sqlite>

comment:6 by osimons, 17 years ago

Keywords: needinfo removed
Resolution: worksforme
Status: newclosed

That seems to show that there is no value set for database_version - a very likely cause for error on upgrade…

You should do a select * from system; to see if the record exists, and either update it or insert the record with the version number from the PREVIOUS version - the one you are upgrading from.

You can find the version number at the top of the 'trac/db_default.py' file. If for example you are upgrading from 0.10.1, you can see it here: source:/tags/trac-0.10.1/trac/db_default.py

How it went missing is not easy to say, but I'm quite sure it is nothing related to Trac itself. I'm closing as 'worksforme', and please reopen if the problem persists - like the value goes missing again.

Modify Ticket

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