Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Trac: Users

Run external command, after the close a ticket

 

 

Trac users RSS feed   Index | Next | Previous | View Threaded


ivanelsonnunes at gmail

Jul 23, 2013, 8:47 PM

Post #1 of 5 (53 views)
Permalink
Run external command, after the close a ticket

I want to execute an external command, after the closing of a Ticket.

So I tried to make a "plugin" based ITicketChangeListener.

from trac.core import *
> from trac.ticket.api import ITicketChangeListener
> class IntegrateTracGLPI(Component):
> implements(ITicketChangeListener)
> # ITicketChangeListener methods
> def ticket_created(self, ticket):
> log = open("/tmp/log.txt","a")
> log.write("created\a")
> log.close()
> def ticket_changed(self, ticket, comment, author, old_values):
> log = open("/tmp/log.txt","a")
> log.write("changed\a")
> log.close()
> """ Update GLPI Database... """
> def ticket_deleted(self, ticket):
> pass



The method "ticket_changed", it is not running.

My plugin is in the directory /var/mytracenv/plugins. And also see the
trac.log loaded.

My objective is only to run an external routine. So also accepted the
suggestion of some existing in T-H.


@ivanelson
[]s

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe [at] googlegroups
To post to this group, send email to trac-users [at] googlegroups
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/groups/opt_out.


rjollos at gmail

Aug 7, 2013, 2:10 PM

Post #2 of 5 (17 views)
Permalink
Re: Run external command, after the close a ticket [In reply to]

On Tuesday, July 23, 2013 8:47:01 PM UTC-7, ivanelson wrote:

> I want to execute an external command, after the closing of a Ticket.
>
> So I tried to make a "plugin" based ITicketChangeListener.
>
> from trac.core import *
>> from trac.ticket.api import ITicketChangeListener
>> class IntegrateTracGLPI(Component):
>> implements(ITicketChangeListener)
>> # ITicketChangeListener methods
>> def ticket_created(self, ticket):
>> log = open("/tmp/log.txt","a")
>> log.write("created\a")
>> log.close()
>> def ticket_changed(self, ticket, comment, author, old_values):
>> log = open("/tmp/log.txt","a")
>> log.write("changed\a")
>> log.close()
>> """ Update GLPI Database... """
>> def ticket_deleted(self, ticket):
>> pass
>
>
>
> The method "ticket_changed", it is not running.
>
> My plugin is in the directory /var/mytracenv/plugins. And also see the
> trac.log loaded.
>
> My objective is only to run an external routine. So also accepted the
> suggestion of some existing in T-H.
>

I'm not spotting what's wrong with your ITicketChangeListener
implementation, but AdvancedTicketWorkflowPlugin has a run_external
operation that might be of use to you.

http://trac-hacks.org/wiki/AdvancedTicketWorkflowPlugin

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe [at] googlegroups
To post to this group, send email to trac-users [at] googlegroups
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/groups/opt_out.


ivanelsonnunes at gmail

Aug 7, 2013, 4:03 PM

Post #3 of 5 (17 views)
Permalink
Re: Re: Run external command, after the close a ticket [In reply to]

Rjollos,

1. I do not understand how to configure/use this function. :(


> AdvancedTicketWorkflowPlugin
>
> - run_external (TicketWorkflowOpRunExternal)
>
>
2. I fixed my implementation. Trac and [1]GLPI are integrated.

As always, you are very attentive.

Thank you.

[1]http://www.glpi-project.org/

@ivanelson
[]s




2013/8/7 RjOllos <rjollos [at] gmail>

> On Tuesday, July 23, 2013 8:47:01 PM UTC-7, ivanelson wrote:
>
>> I want to execute an external command, after the closing of a Ticket.
>>
>> So I tried to make a "plugin" based ITicketChangeListener.
>>
>> from trac.core import *
>>> from trac.ticket.api import ITicketChangeListener
>>> class IntegrateTracGLPI(Component):
>>> implements(**ITicketChangeListener)
>>> # ITicketChangeListener methods
>>> def ticket_created(self, ticket):
>>> log = open("/tmp/log.txt","a")
>>> log.write("created\a")
>>> log.close()
>>> def ticket_changed(self, ticket, comment, author, old_values):
>>> log = open("/tmp/log.txt","a")
>>> log.write("changed\a")
>>> log.close()
>>> """ Update GLPI Database... """
>>> def ticket_deleted(self, ticket):
>>> pass
>>
>>
>>
>> The method "ticket_changed", it is not running.
>>
>> My plugin is in the directory /var/mytracenv/plugins. And also see the
>> trac.log loaded.
>>
>> My objective is only to run an external routine. So also accepted the
>> suggestion of some existing in T-H.
>>
>
> I'm not spotting what's wrong with your ITicketChangeListener
> implementation, but AdvancedTicketWorkflowPlugin has a run_external
> operation that might be of use to you.
>
> http://trac-hacks.org/wiki/AdvancedTicketWorkflowPlugin
>
> --
> You received this message because you are subscribed to the Google Groups
> "Trac Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to trac-users+unsubscribe [at] googlegroups
> To post to this group, send email to trac-users [at] googlegroups
> Visit this group at http://groups.google.com/group/trac-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe [at] googlegroups
To post to this group, send email to trac-users [at] googlegroups
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/groups/opt_out.


rjollos at gmail

Aug 7, 2013, 4:15 PM

Post #4 of 5 (16 views)
Permalink
Re: Re: Run external command, after the close a ticket [In reply to]

On Wednesday, August 7, 2013 4:03:21 PM UTC-7, ivanelson wrote:

> Rjollos,
>
> 1. I do not understand how to configure/use this function. :(
>
>
>> AdvancedTicketWorkflowPlugin
>>
>> - run_external (TicketWorkflowOpRunExternal)
>>
>>
I haven't used it myself, and it looks like the documentation could be
improved a bit. From reading the brief documentation and source code, it
will run a script in $env/hooks/ (it would be nice if the script location
was a configuration option). The script can have no extension, or the
`cmd`, `bat` or `exe` extensions. The script gets passed the ticket id as a
string and user's session name.

http://trac-hacks.org/browser/advancedticketworkflowplugin/0.12/advancedworkflow/controller.py?rev=9962&marks=316#L312


If needed you could modify the source code to pass additional information.
The caller is a subclass of Component and is passed a Request object, so it
seems you'd have quite a bit of flexibility if you wanted to pass more
information to the script.

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe [at] googlegroups
To post to this group, send email to trac-users [at] googlegroups
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/groups/opt_out.


ivanelsonnunes at gmail

Aug 7, 2013, 4:20 PM

Post #5 of 5 (17 views)
Permalink
Re: Re: Run external command, after the close a ticket [In reply to]

Rjollos,

Liked it! In the future I can use this code as a base to climb my plugin
that integrates the trac and glpi. Anyway, it was a good idea.

@ivanelson
[]s


2013/8/7 RjOllos <rjollos [at] gmail>

> On Wednesday, August 7, 2013 4:03:21 PM UTC-7, ivanelson wrote:
>
>> Rjollos,
>>
>> 1. I do not understand how to configure/use this function. :(
>>
>>
>>> AdvancedTicketWorkflowPlugin
>>>
>>> - run_external (TicketWorkflowOpRunExternal)
>>>
>>>
> I haven't used it myself, and it looks like the documentation could be
> improved a bit. From reading the brief documentation and source code, it
> will run a script in $env/hooks/ (it would be nice if the script location
> was a configuration option). The script can have no extension, or the
> `cmd`, `bat` or `exe` extensions. The script gets passed the ticket id as a
> string and user's session name.
>
>
> http://trac-hacks.org/browser/advancedticketworkflowplugin/0.12/advancedworkflow/controller.py?rev=9962&marks=316#L312
>
>
> If needed you could modify the source code to pass additional information.
> The caller is a subclass of Component and is passed a Request object, so it
> seems you'd have quite a bit of flexibility if you wanted to pass more
> information to the script.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Trac Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to trac-users+unsubscribe [at] googlegroups
> To post to this group, send email to trac-users [at] googlegroups
> Visit this group at http://groups.google.com/group/trac-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe [at] googlegroups
To post to this group, send email to trac-users [at] googlegroups
Visit this group at http://groups.google.com/group/trac-users.
For more options, visit https://groups.google.com/groups/opt_out.

Trac users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.