Scripting trac-admin, result codes

15 views
Skip to first unread message

Mo

unread,
Jan 17, 2017, 4:50:47 AM1/17/17
to Trac Users
Hi, is there any result code or documentation of trac-admin?
It seems that it does not send result codes.

I have a cronjob doing the "changeset added" every 5 minutes after synchronizing git.
If Trac returns errors in this while I need to buffer the changesets in order to retry later. But I can't see a way to check if "trac-admin changeset added" was successful.

Best regards,
Mo

Peter Suter

unread,
Jan 17, 2017, 2:02:06 PM1/17/17
to trac-...@googlegroups.com
trac-admin does set the exit status / error level in theory. This seems
to work for me for simple things.
"trac-admin env help" sets it to 0.
"trac-admin env WRONG" sets it to 2.
https://trac.edgewall.org/browser/trunk/trac/admin/console.py?rev=15259&marks=112,132,629,644,651#L101

But "trac-admin env changeset added WRONG WRONG" prints "Repository
'WRONG' not found", while also setting the error level to 0.
Indeed there's no attempt to return anything indicating the printed
error here:
https://trac.edgewall.org/browser/trunk/trac/versioncontrol/admin.py?rev=15259&marks=96,97#L91
Also the errors are printed to stdout, not sterr.
Sounds like a bug (or missing feature) to me.

But I'm not familiar with that cmd.Cmd.onecmd() mechanism, and if it's
even possible to pass an error status through there.
https://docs.python.org/2/library/cmd.html#cmd.Cmd.onecmd

Best regards,
Peter

Mo

unread,
Jan 18, 2017, 10:28:26 AM1/18/17
to Trac Users
Anyway, I'm going the hard way now by parsing stdout... Seems that if stdout length is not zero, there is something wrong (error).

Best regards,
Mo

RjOllos

unread,
Jan 20, 2017, 3:57:18 AM1/20/17
to Trac Users
Reply all
Reply to author
Forward
0 new messages