Edgewall Software

Opened 17 years ago

Last modified 7 years ago

#2162 new enhancement

trac-admin needs a -q for quiet automated operation

Reported by: dbeckham-trac@… 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:


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 anonymous, 17 years ago

I'd like to add cast my vote as a proposed feature/fix as well.

comment:2 by anonymous, 16 years ago

anything happening on this ticket? I would like to have a quiet/silent output too.

comment:3 by Christian Boos, 15 years ago

Milestone: 1.0

comment:4 by dkg-debian.org@…, 15 years ago

fwiw, I'd also like to see this happen.

comment:5 by dkg-debian.org@…, 15 years ago

Cc: dkg-debian.org@… added

comment:6 by demarco@…, 15 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.


in reply to:  6 comment:7 by osimons, 14 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

    12371237        return html.PRE(buf.getvalue(), class_='wiki')
     1240class DevNull(object):
     1241    """ A simple mock file object that emulates /dev/null behaviour. """
     1242    def write(self, input):
     1243        return True
    12401245def run(args=None):
    12411246    """Main entry point."""
    12421247    if args is None:
    12481253        elif args[0] in ('-v','--version'):
    12491254            print '%s %s' % (os.path.basename(sys.argv[0]), TRAC_VERSION)
    12501255        else:
     1256            if args[0] == '-q':
     1257                del(args[0])
     1258                sys.stdout = DevNull()
    12511259            admin.env_set(os.path.abspath(args[0]))
    12521260            if len(args) > 1:
    12531261                s_args = ' '.join(["'%s'" % c for c in args[2:]])

comment:8 by Christian Boos, 13 years ago

Type: defectenhancement

comment:9 by Christian Boos, 12 years ago

Milestone: 1.0unscheduled

Milestone 1.0 deleted

comment:10 by Thijs Triemstra <lists@…>, 12 years ago

Cc: lists@… added

comment:11 by Thijs Triemstra, 11 years ago

Cc: Thijs Triemstra added; lists@… removed

comment:12 by Ryan J Ollos, 7 years ago

Owner: daniel removed

Modify Ticket

Change Properties
Set your email in Preferences
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set. Next status will be 'closed'.
The owner will be changed from (none) to anonymous. Next status will be 'assigned'.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.