#9183 closed defect (fixed)
Upgrade fails in trac 0.12 with Postgresql db
Reported by: | Owned by: | Jun Omae | |
---|---|---|---|
Priority: | high | Component: | StickyTicketPlugin |
Severity: | blocker | Keywords: | upgrade, trac-admin |
Cc: | Russ Tyndall | Trac Release: | 0.12 |
Description
Trac version: 0.12.2
Database: psql (PostgreSQL) 8.4.8
timingandestimationplugin SVN version: 10655
I have successfully installed 'timingandestimationplugin' and enabled it in the [components].
However, when I run:
sudo trac-admin /var/www/trac/local upgrade
I get this error:
TypeError: environment_needs_upgrade() takes exactly 1 argument (2 given)
I tried both variants, with Permission and without permission.
I have expert programming skills in Java, but would refrain from touching python programming language and don't want to mess up timingandestimationplugin project.
Attachments (0)
Change History (11)
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
System Information
Trac | 0.12.2 |
Babel | 0.9.5 |
Docutils | 0.7 |
Genshi | 0.6 |
mod_python | 3.3.1 |
psycopg2 | 2.4.2 |
Pygments | 1.4 |
Python | 2.7.1+ (r271:86832, Apr 11 2011, 18:37:12) [GCC 4.5.2] |
pytz | 2010b |
setuptools | 0.6 |
Subversion | 1.6.12 (r955767) |
jQuery | 1.4.2 |
Installed Plugins
AutocompleteUsers | 0.4.2 | /usr/local/lib/python2.7/dist-packages/AutocompleteUsers-0.4.2-py2.7.egg |
StickyTicketPlugin | 0.12.0.1 | /usr/local/lib/python2.7/dist-packages/StickyTicketPlugin-0.12.0.1-py2.7.egg |
TimingAndEstimationPlugin | 1.1.9 | /usr/local/lib/python2.7/dist-packages/timingandestimationplugin-1.1.9-py2.7.egg |
TracBzr | 0.4.2 | /usr/local/lib/python2.7/dist-packages/TracBzr-0.4.2-py2.7.egg |
TracSectionEditPlugin | 0.2.1-r10449 | /usr/local/lib/python2.7/dist-packages/TracSectionEditPlugin-0.2.1_r10449-py2.7.egg |
TracSubPages | 0.5 | /usr/local/lib/python2.7/dist-packages/TracSubPages-0.5-py2.7.egg |
TracWysiwygPlugin | 0.12.0.3-r9676 | /usr/local/lib/python2.7/dist-packages/TracWysiwyg-0.12.0.3_r9676-py2.7.egg |
Log Trace
galaxy:~$ sudo trac-admin /var/www/trac/local upgrade --no-backup [[BR]] !TypeError: environment_needs_upgrade() takes exactly 1 argument (2 given)
2011-09-16 11:56:00,287 Trac[env] INFO: -------------------------------- environment startup [Trac 0.12.2] -------------------------------- 2011-09-16 11:56:00,302 Trac[loader] DEBUG: Loading TracSubPages from /usr/local/lib/python2.7/dist-packages/TracSubPages-0.5-py2.7.egg 2011-09-16 11:56:00,303 Trac[loader] DEBUG: Loading autocompleteusers from /usr/local/lib/python2.7/dist-packages/AutocompleteUsers-0.4.2-py2.7.egg 2011-09-16 11:56:00,303 Trac[loader] DEBUG: Loading bzr from /usr/local/lib/python2.7/dist-packages/TracBzr-0.4.2-py2.7.egg 2011-09-16 11:56:00,385 Trac[loader] DEBUG: Loading timingandestimationplugin from /usr/local/lib/python2.7/dist-packages/timingandestimationplugin-1.1.9-py2.7.egg 2011-09-16 11:56:00,388 Trac[loader] DEBUG: Loading trac.about from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,388 Trac[loader] DEBUG: Loading trac.admin.console from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,388 Trac[loader] DEBUG: Loading trac.admin.web_ui from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,390 Trac[loader] DEBUG: Loading trac.attachment from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,390 Trac[loader] DEBUG: Loading trac.db.mysql from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,395 Trac[loader] DEBUG: Loading trac.db.postgres from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,403 Trac[loader] DEBUG: Loading trac.db.sqlite from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,405 Trac[loader] DEBUG: Loading trac.mimeview.patch from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,406 Trac[loader] DEBUG: Loading trac.mimeview.pygments from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,417 Trac[loader] DEBUG: Loading trac.mimeview.rst from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,510 Trac[loader] DEBUG: Loading trac.mimeview.silvercity from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,518 Trac[loader] DEBUG: Skipping "trac.mimeview.silvercity = trac.mimeview.silvercity [silvercity]": ("DistributionNotFound: SilverCity>=0.9.4" not found) 2011-09-16 11:56:00,518 Trac[loader] DEBUG: Loading trac.mimeview.txtl from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,527 Trac[loader] DEBUG: Skipping "trac.mimeview.txtl = trac.mimeview.txtl [textile]": ("DistributionNotFound: textile>=2.0" not found) 2011-09-16 11:56:00,527 Trac[loader] DEBUG: Loading trac.prefs from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,528 Trac[loader] DEBUG: Loading trac.search from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,528 Trac[loader] DEBUG: Loading trac.ticket.admin from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,529 Trac[loader] DEBUG: Loading trac.ticket.query from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,532 Trac[loader] DEBUG: Loading trac.ticket.report from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,533 Trac[loader] DEBUG: Loading trac.ticket.roadmap from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,534 Trac[loader] DEBUG: Loading trac.ticket.web_ui from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,535 Trac[loader] DEBUG: Loading trac.timeline from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,536 Trac[loader] DEBUG: Loading trac.versioncontrol.admin from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,537 Trac[loader] DEBUG: Loading trac.versioncontrol.svn_authz from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,537 Trac[loader] DEBUG: Loading trac.versioncontrol.svn_fs from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,539 Trac[loader] DEBUG: Loading trac.versioncontrol.svn_prop from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,539 Trac[loader] DEBUG: Loading trac.versioncontrol.web_ui from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,540 Trac[loader] DEBUG: Loading trac.web.auth from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,543 Trac[loader] DEBUG: Loading trac.web.session from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,544 Trac[loader] DEBUG: Loading trac.wiki.admin from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,544 Trac[loader] DEBUG: Loading trac.wiki.interwiki from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,545 Trac[loader] DEBUG: Loading trac.wiki.macros from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,545 Trac[loader] DEBUG: Loading trac.wiki.web_api from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,546 Trac[loader] DEBUG: Loading trac.wiki.web_ui from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,547 Trac[loader] DEBUG: Loading tracopt.mimeview.enscript from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,547 Trac[loader] DEBUG: Loading tracopt.mimeview.php from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,548 Trac[loader] DEBUG: Loading tracopt.perm.authz_policy from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,548 Trac[loader] DEBUG: Loading tracopt.perm.config_perm_provider from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,549 Trac[loader] DEBUG: Loading tracopt.ticket.commit_updater from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,550 Trac[loader] DEBUG: Loading tracopt.ticket.deleter from /usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg 2011-09-16 11:56:00,551 Trac[loader] DEBUG: Loading tracsectionedit.web_ui from /usr/local/lib/python2.7/dist-packages/TracSectionEditPlugin-0.2.1_r10449-py2.7.egg 2011-09-16 11:56:00,551 Trac[loader] DEBUG: Loading tracstickyticket.web_ui from /usr/local/lib/python2.7/dist-packages/StickyTicketPlugin-0.12.0.1-py2.7.egg 2011-09-16 11:56:00,597 Trac[loader] DEBUG: Loading tracwysiwyg from /usr/local/lib/python2.7/dist-packages/TracWysiwyg-0.12.0.3_r9676-py2.7.egg 2011-09-16 11:56:00,632 Trac[default_workflow] DEBUG: Workflow actions at initialization: {u'resolve': {u'operations': [u'set_resolution'], 'name': u'resolve', 'default': 0, 'newstate': u'closed', 'oldstates': [u'new', u'assigned', u'accepted', u'reopened'], u'permissions': [u'TICKET_MODIFY']}, u'accept': {u'operations': [u'set_owner_to_self'], 'name': u'accept', 'default': 0, 'newstate': u'accepted', 'oldstates': [u'new', u'assigned', u'accepted', u'reopened'], u'permissions': [u'TICKET_MODIFY']}, u'leave': {u'operations': [u'leave_status'], 'name': u'leave', u'default': 1, 'newstate': u'*', 'oldstates': [u'*'], 'permissions': []}, u'reopen': {u'operations': [u'del_resolution'], 'name': u'reopen', 'default': 0, 'newstate': u'reopened', 'oldstates': [u'closed'], u'permissions': [u'TICKET_CREATE']}, u'reassign': {u'operations': [u'set_owner'], 'name': u'reassign', 'default': 0, 'newstate': u'assigned', 'oldstates': [u'new', u'assigned', u'accepted', u'reopened'], u'permissions': [u'TICKET_MODIFY']}, '_reset': {'operations': ['reset_workflow'], 'name': 'reset', 'default': 0, 'newstate': 'new', 'oldstates': [], 'permissions': []}} 2011-09-16 11:56:00,636 Trac[api] DEBUG: T&E NEEDS UP?: sys:True, rep:True, stats:True, fields:True, man:True 2011-09-16 11:56:00,636 Trac[env] WARNING: Component <timingandestimationplugin.api.TimeTrackingSetupParticipant object at 0x3471250> requires environment upgrade 2011-09-16 11:56:00,638 Trac[api] DEBUG: T&E NEEDS UP?: sys:True, rep:True, stats:True, fields:True, man:True 2011-09-16 11:56:00,639 Trac[console] ERROR: Exception in trac-admin command: Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg/trac/admin/console.py", line 107, in onecmd rv = cmd.Cmd.onecmd(self, line) or 0 File "/usr/lib/python2.7/cmd.py", line 218, in onecmd return self.default(line) File "/usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg/trac/admin/console.py", line 266, in default return cmd_mgr.execute_command(*args) File "/usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg/trac/admin/api.py", line 123, in execute_command return f(*fargs) File "/usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg/trac/env.py", line 782, in _do_upgrade self.env.upgrade(backup=no_backup is None) File "/usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg/trac/env.py", line 514, in upgrade if participant.environment_needs_upgrade(db): TypeError: environment_needs_upgrade() takes exactly 1 argument (2 given)
comment:3 Changed 13 years ago by
I am not sure whether this ticket will add some value to this problem:
comment:4 Changed 13 years ago by
Well I submitted those patches, so it was definitely useful to me at some point.
This error doesn't seem related though... I will attempt to track this down later today or tomorrow (pretty busy just at the moment). It seems like this must be a problem in T&E even though it works for me (because i have had other similar bug reports come over email).
comment:5 Changed 13 years ago by
I just verified that on a totally clean trac install/instance and the latest version of the plugin install correctly on my server without the mentioned error. Will look into this further later today
comment:6 Changed 13 years ago by
Would it possible to get you to add a log statement in the trac source code trac/env.py to make it possible to see what is causing the breakage?
Here is the change. Please post your log if you can make this change and get the error message.
-
trac/env.py
> svn diff trac/env.py
511 511 upgraders = [] 512 512 db = self.get_read_db() 513 513 for participant in self.setup_participants: 514 if participant.environment_needs_upgrade(db): 515 upgraders.append(participant) 514 try: 515 if participant.environment_needs_upgrade(db): 516 upgraders.append(participant) 517 except Exception, e: 518 self.log.exception('Error running participant.environment_needs_upgrade %s %r %s' 519 % (participant.__class__.__name__, participant, participant)) 520 raise e 516 521 if not upgraders: 517 522 return 518 523
Sorry, I can't fix it until I can recreate it :/
comment:7 Changed 13 years ago by
I tried making the code change you suggested but struggled little bit with it.
I hope the logs below will help.
2011-09-21 14:28:23,736 Trac[env] ERROR: Error running participant.environment_needs_upgrade StickyTicketModule <tracstickyticket.web_ui.StickyTicketModule object at 0x33cc690> <tracstickyticket.web_ui.StickyTicketModule object at 0x33cc690> Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg/trac/env.py", line 517, in upgrade if participant.environment_needs_upgrade(db): TypeError: environment_needs_upgrade() takes exactly 1 argument (2 given) 2011-09-21 14:28:23,738 Trac[console] ERROR: Exception in trac-admin command: Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg/trac/admin/console.py", line 107, in onecmd rv = cmd.Cmd.onecmd(self, line) or 0 File "/usr/lib/python2.7/cmd.py", line 218, in onecmd return self.default(line) File "/usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg/trac/admin/console.py", line 266, in default return cmd_mgr.execute_command(*args) File "/usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg/trac/admin/api.py", line 123, in execute_command return f(*fargs) File "/usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg/trac/env.py", line 787, in _do_upgrade self.env.upgrade(backup=no_backup is None) File "/usr/local/lib/python2.7/dist-packages/Trac-0.12.2-py2.7.egg/trac/env.py", line 521, in upgrade raise e TypeError: environment_needs_upgrade() takes exactly 1 argument (2 given)
comment:8 follow-up: 11 Changed 13 years ago by
Cc: | Russ Tyndall added; anonymous removed |
---|---|
Component: | TimingAndEstimationPlugin → StickyTicketPlugin |
Owner: | changed from Russ Tyndall to Jun Omae |
You got exactly what I needed to see, so thank you!
2011-09-21 14:28:23,736 Trac[env] ERROR: Error running participant.environment_needs_upgrade
StickyTicketModule <tracstickyticket.web_ui.StickyTicketModule object at 0x33cc690>
The tracstickyticket.web_ui.StickyTicketModule is what is preventing you from upgrading (rather than TimingAndEstimationPlugin).
Which if we look at line 40 we see that it doesnt include the proper (self, db) arg list (missing self).
It seems like that plugin could just stop implementing IEnvironmentSetupParticipant since all it does on all its methods is call pass. Here is a patch that will get that plugin working for you (so you can upgrade).
-
tracstickyticket/web_ui.py
17 17 __all__ = ['StickyTicketModule'] 18 18 19 19 class StickyTicketModule(Component): 20 implements(IContentConverter , IEnvironmentSetupParticipant)20 implements(IContentConverter) 21 21 22 22 _pagesize = Option('sticky-ticket', 'pagesize', 'A4', 23 23 doc="Page size of PDF file which the tickets is printed") … … 33 33 dir = resource_filename(__name__, 'locale') 34 34 add_domain(self.env.path, dir) 35 35 36 # IEnvironmentSetupParticipant37 def environment_created():38 pass39 40 def environment_needs_upgrade(db):41 return False42 43 def upgrade_environment(db):44 pass45 46 36 # IContentConverter 47 37 def get_supported_conversions(self): 48 38 yield ('sticky-ticket', _("Sticky"), 'pdf',
comment:9 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:10 Changed 13 years ago by
Because I want to call add_domain
method as soon as possible, StickyTicketModule
has IEnvironmentSetupParticipant
interface. Otherwise, the first response after tracd/apache launches do untranslated messages.
This has been tested and working against trac 12 / postgresql recently. I will check again, but do you have any other plugins enabled? Can you please paste the versions section from the about trac page (when logged in as admin there will be a table of all the versions of all the main trac components and all the plugin versions)? Also please enable t:TracLogging and post the log from this failed upgrade attempt, as this will give me the full stack trace of where the error is coming from.
Otherwise you might try the upgrade with the --no-backup flag. (Obviously you should make a backup manually if you feel the need) Some versions of trac are incapable of backing up a postgresql database, but dont do a good job of reporting that this is what caused the error.
Also from env.py in Trac 0.12.3dev-r10792 (a revision from branches/0.12-stable) strongly implies that T&E has the correct method signature :
Cheers, I hope we can get your problems sorted soon,
Russ