Modify

Opened 18 years ago

Last modified 3 years ago

#942 new enhancement

Support for recurring (scheduled) tickets

Reported by: Mike Comb Owned by: anybody
Priority: highest Component: Request-a-Hack
Severity: normal Keywords:
Cc: Trac Release: 0.10

Description

I'd love to see support for recurring tickets. For example, every Tuesday my QA person should get a "Validate Weekly Build" ticket without someone having to manually enter it.

Attachments (0)

Change History (19)

comment:1 Changed 18 years ago by anonymous

one vote

comment:2 Changed 18 years ago by kerstin.tenbrock@…

Second vote!

comment:3 Changed 18 years ago by anonymous

third vote!

comment:4 in reply to:  description Changed 17 years ago by rtapia@…

4th Vote!

comment:5 Changed 17 years ago by anonymous

n'th vote for this

comment:6 Changed 16 years ago by Drew

I vote for this, massively!!! Even if tickets are created through Cron every hour or so..

Also not just recurring, but once off - date based tickets. Set a ticket to show up at 5pm 15 december 2010 and forget about it, when the time comes the ticket shows!

Very, VERY useful addition..

comment:7 Changed 15 years ago by anonymous

Priority: normalhighest
Severity: normalcritical

comment:8 Changed 15 years ago by Ryan J Ollos

Cc: Ryan J Ollos added; anonymous removed

comment:9 Changed 15 years ago by Ryan J Ollos

It seems like the most flexible way to do this would be, as someone mentioned, to generate the tickets from Cron. It is my understanding that tickets can be created from the command line using SQL insert statements, therefore a simple implementation of this feature could be some scripts and SQL macros that help with ticket generation. Perhaps a webadmin interface for created the cron scripts would be convenient as well.

comment:10 Changed 15 years ago by Ryan J Ollos

Summary: Support for recurring ticketsSupport for recurring (scheduled) tickets

comment:11 Changed 15 years ago by wick2o@…

I do this from CRON myself. Here is the code that you need to use.

Create the file trac-bug.py and place the following inside of it.

#!/usr/bin/python

import os, sys, getopt

def usage():
        print>> sys.stderr, "Usage: trac-bug -h -S Summary -D Description -T Type -P Priority -C Component -O Owner -R Reporter -I Requested By -M Milestone"
        print>> sys.stderr, "-U = user_priority"
        print>> sys.stderr, "-c = plz_complete_by"
        print>> sys.stderr, "-b = location"
        print>> sys.stderr, "-h = helpdesk"
        return


def main():
        try:
                opts, args = getopt.getopt(sys.argv[1:], "hS:D:T:P:C:O:R:I:U:M:c:b:",[])
        except getopt.GetoptError, err:
                #Print help Information and exit
                print str(err)
                usage()
                sys.exit(2)

        TRAC_ENV = ''
        tp= 'task'
        pri= 'major'
        own= ''
        desc= ''
        summ= ''
        comp= ''
        report = 'ServerAutomation'
        ips = 'wick2o'
        usrp = ''
        pcb = ''
        loc = ''
        mile = ''

        for o, a in opts:
          if o == "-h":
                TRAC_ENV = os.path.abspath('/var/lib/trac/helpdesk')
          elif o == "-S":
                summ= a
          elif o == "-D":
                desc= a
          elif o == "-T":
                tp = a
          elif o == "-P":
                pri = a
          elif o == "-C":
                comp = a
          elif o == "-O":
                own = a
          elif o == "-R":
                report = a
          elif o == "-I":
                ips = a
          elif o == "-U":
                usrp = a
          elif o == "-c":
                pcb = a
          elif o == "-b":
                loc = a
          elif o == "-M":
                mile = a
          elif o == "-O":
                own = a
          else:
                assert FALSE, "unhandled option"

        if not os.path.isdir(TRAC_ENV):
                print >>sys.stderr, "TRAC_ENV is not a directory."
                usage()
                sys.exit(2)

        from trac.env import open_environment
        from trac.ticket import Ticket
        t = Ticket(open_environment(TRAC_ENV))

        if "TRAC_ENV" = "/var/lib/trac/eworld":
                info = dict(
                        type= tp,
                        summary= summ,
                        priority= pri,
                        component= comp,
                        owner= own,
                        description = desc,
                        reporter = report,
                        status = 'new',
                        interested_partys = ips,
                        user_priority = usrp,
                        plz_complete_by = pcb,
                        location = loc
                )
        

        t.populate(info)
        num = t.insert()
        if not num:
                print >>sys.stderr, "Ticket not created"
                print >>sys.stderr, vals
                sys.exit(1)

        print "Ticket #%d: %s" % (num,summ)
        sys.exit(0)                 # all is well
        return


if __name__ == "__main__":
        main()

Now modify your crontab and enter a line such as this...

30 6 1 6,12 * /usr/local/bin/trac-bug.py -h -S "Test Subject" -D "Test Description Here" -T "task" -P "minor" -C "Help Desk" -O "owner" -R "reporter" -I "Interested Partys" -U "0" -b "9w" >/dev/null 2>&1

Now keep in mind I wrote this to solve my own needs, so I've watered this down to only work with one trac project. It also includes some custom fields that you may not have in your system, such as location,plz_complete_by, and user_priority

Disclaimer, I am not a python programmer, nor have I ever written a trac plugin. Just a linux user who automates his own tasks because he is lazy :)

comment:12 Changed 14 years ago by Jay

I am "for" this idea. with one catch, if anyone implements this, please make it so each "recurrence" of the ticket is actually a new ticket.

We have a "custom" system here, with recurring tasks, but they task ID never changes from week to week, as a result it makes them useless for data mining later on.

comment:13 Changed 13 years ago by tsetliff@…

I nth + 1 this. Some management components where we interface with people outside of IT. For example low priority quarterly documentation updates. Telling people to do a visual inspection of something every month.

comment:14 Changed 12 years ago by anonymous

+1

comment:15 Changed 12 years ago by anonymous

+1

comment:16 Changed 11 years ago by anonymous

Yes please. +1

comment:17 Changed 7 years ago by figaro

Severity: criticalnormal

comment:18 Changed 7 years ago by anonymous

comment:19 Changed 5 years ago by Ryan J Ollos

Cc: Ryan J Ollos removed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain anybody.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.