Scripting trac-admin, result codes

15 lượt xem
Chuyển tới thư đầu tiên chưa đọc

Mo

chưa đọc,
04:50:47 17 thg 1, 201717/1/17
đến 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

chưa đọc,
14:02:06 17 thg 1, 201717/1/17
đến 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

chưa đọc,
10:28:26 18 thg 1, 201718/1/17
đến 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

chưa đọc,
03:57:18 20 thg 1, 201720/1/17
đến Trac Users
Trả lời tất cả
Trả lời tác giả
Chuyển tiếp
0 tin nhắn mới