Opened 19 years ago
Last modified 10 years ago
#2162 new enhancement
trac-admin needs a -q for quiet automated operation
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Milestone: | unscheduled |
Component: | admin/console | Version: | 0.9b2 |
Severity: | normal | Keywords: | |
Cc: | dkg-debian.org@…, Thijs Triemstra | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
The trac-admin tool needs a -q option to make it shut up. When using it for automated operations, such as hotcopying for a backup, it's very chatty. Honestly, I'm not interested in it's success status, only it's failure so that I can act accordingly.
Attachments (0)
Change History (12)
comment:1 by , 19 years ago
comment:2 by , 18 years ago
anything happening on this ticket? I would like to have a quiet/silent output too.
comment:3 by , 18 years ago
Milestone: | → 1.0 |
---|
comment:5 by , 18 years ago
Cc: | added |
---|
follow-up: 7 comment:6 by , 18 years ago
Hey, there's a really easy fix for this!
trac-admin hotcopy… >/dev/null
I looked at patching -q into admin.py, but found that the bit in charge of actually running the commands sends errors to STDERR, and most commands send "informative output" to STDOUT. So you can easily discard STDOUT and be assured that you'll still hear about errors. I tested this with normal and failed hotcopies, and it works as advertised.
Recommend documenting this in a FAQ and WORKSFORME'ing this ticket.
HTH
comment:7 by , 16 years ago
Replying to demarco@maya.com:
trac-admin hotcopy… >/dev/null
That won't work so well on Windows. I wanted to test the stdout
vs. stderr
usage, so I made a simple patch to try out a -q
option. That actually worked quite well.
trac-admin -q /path/to/env hotcopy
for instance should now just print errors.
I'm just dropping the patch here for future reference in case someone wants to revive this issue - my only intention now was to see if I could make it work…
-
trac/admin/console.py
1237 1237 return html.PRE(buf.getvalue(), class_='wiki') 1238 1238 1239 1239 1240 class DevNull(object): 1241 """ A simple mock file object that emulates /dev/null behaviour. """ 1242 def write(self, input): 1243 return True 1244 1240 1245 def run(args=None): 1241 1246 """Main entry point.""" 1242 1247 if args is None: … … 1248 1253 elif args[0] in ('-v','--version'): 1249 1254 print '%s %s' % (os.path.basename(sys.argv[0]), TRAC_VERSION) 1250 1255 else: 1256 if args[0] == '-q': 1257 del(args[0]) 1258 sys.stdout = DevNull() 1251 1259 admin.env_set(os.path.abspath(args[0])) 1252 1260 if len(args) > 1: 1253 1261 s_args = ' '.join(["'%s'" % c for c in args[2:]])
comment:8 by , 15 years ago
Type: | defect → enhancement |
---|
comment:10 by , 14 years ago
Cc: | added |
---|
comment:11 by , 14 years ago
Cc: | added; removed |
---|
comment:12 by , 10 years ago
Owner: | removed |
---|
I'd like to add cast my vote as a proposed feature/fix as well.