Re: [rt-users] Automatically opening stalled RT tickets
On 22/07/2008, at 9:58 AM, Ryan Hardester wrote: > I tried this, put the PM in the correct folder, and ran the script. I > get the following error under RT3.8.0 > > [Tue Jul 22 00:37:05 2008] [crit]: Can't call method "Message" on an > undefined value at /opt/rt3/bin/../lib/RT/Action/AutoOpen.pm line 77. > (/opt/rt3/bin/../lib/RT.pm:375) > Can't call method "Message" on an undefined value at > /opt/rt3/bin/../lib/RT/Action/AutoOpen.pm line 77. > > Am I doing something wrong? Or is there a change in 3.8 that makes > this > not work? > > --Ryan I haven't tested it on 3.8 yet, only 3.6. However, this error looks unrelated and occurs before my code even runs. Your TransactionObj is undefined in RT::Action::AutoOpen::Prepare(), I'm not sure what would cause that. Regards, Tom ___ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: [EMAIL PROTECTED] Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com
Re: [rt-users] Automatically opening stalled RT tickets
I tried this, put the PM in the correct folder, and ran the script. I get the following error under RT3.8.0 [Tue Jul 22 00:37:05 2008] [crit]: Can't call method "Message" on an undefined value at /opt/rt3/bin/../lib/RT/Action/AutoOpen.pm line 77. (/opt/rt3/bin/../lib/RT.pm:375) Can't call method "Message" on an undefined value at /opt/rt3/bin/../lib/RT/Action/AutoOpen.pm line 77. Am I doing something wrong? Or is there a change in 3.8 that makes this not work? --Ryan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tom Lanyon Sent: Sunday, July 20, 2008 8:44 PM To: Matthew Macdonald-Wallace Cc: RT Users Subject: Re: [rt-users] Automatically opening stalled RT tickets On 17/07/2008, at 12:45 AM, Matthew Macdonald-Wallace wrote: > Hi Tom, > > Please forgive the intrusion into your inbox, I noticed your post > dated 23rd June on the rt-users list archives and I am very interested > in your usage of rt-crontool to automatically re-open any stalled > tickets older than a certain age. > > Would it be possible for you to share the command-line arguments you > have used for rt-crontool with the community? > > Thanks in advance, > > Matt Hi Matt, No problems - sorry for the delay getting back to you. I've CC'd the list as well in case anyone else is curious. We currently run something like this, once per day: ## Search for tickets that have had no requestor correspondance for more than 6 days, ## open them and comment (this will notify ticket owner) /var/www/rt.domain.com/rt/bin/rt-crontool \ --search RT::Search::FromSQL \ --search-arg "Queue = 'Foo' AND Status = 'stalled' AND Told < '6 days ago' AND DependsOn IS NULL" \ --action RT::Action::OpenTicketAndComment --action-arg "Auto- opened due to being stalled for > 6 days." You'll also notice the RT::Action::OpenTicketAndComment action which is just a slightly modified RT::Action::AutoOpen so that we can also place a comment in the ticket to show why it was re-opened. I've attached our local/lib/RT/Action/OpenTicketAndComment.pm module if you're interested. Caution: we added the 'DependsOn IS NULL' clause because this was re- opening tickets that were stalled because they depended on another ticket. However, through TicketSQL we are unable to query the status of these depended-on tickets, so currently this won't re-open stalled tickets even if a depended-on ticket is resolved. I consider this a bug with our process and plan to fix it by using a custom RT::Search module to do a more fine-grained query, but haven't had time. Regards, Tom ___ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: [EMAIL PROTECTED] Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com
Re: [rt-users] Automatically opening stalled RT tickets
On 17/07/2008, at 12:45 AM, Matthew Macdonald-Wallace wrote: Hi Tom, Please forgive the intrusion into your inbox, I noticed your post dated 23rd June on the rt-users list archives and I am very interested in your usage of rt-crontool to automatically re-open any stalled tickets older than a certain age. Would it be possible for you to share the command-line arguments you have used for rt-crontool with the community? Thanks in advance, Matt Hi Matt, No problems - sorry for the delay getting back to you. I've CC'd the list as well in case anyone else is curious. We currently run something like this, once per day: ## Search for tickets that have had no requestor correspondance for more than 6 days, ## open them and comment (this will notify ticket owner) /var/www/rt.domain.com/rt/bin/rt-crontool \ --search RT::Search::FromSQL \ --search-arg "Queue = 'Foo' AND Status = 'stalled' AND Told < '6 days ago' AND DependsOn IS NULL" \ --action RT::Action::OpenTicketAndComment --action-arg "Auto- opened due to being stalled for > 6 days." You'll also notice the RT::Action::OpenTicketAndComment action which is just a slightly modified RT::Action::AutoOpen so that we can also place a comment in the ticket to show why it was re-opened. I've attached our local/lib/RT/Action/OpenTicketAndComment.pm module if you're interested. Caution: we added the 'DependsOn IS NULL' clause because this was re- opening tickets that were stalled because they depended on another ticket. However, through TicketSQL we are unable to query the status of these depended-on tickets, so currently this won't re-open stalled tickets even if a depended-on ticket is resolved. I consider this a bug with our process and plan to fix it by using a custom RT::Search module to do a more fine-grained query, but haven't had time. Regards, Tom package RT::Action::OpenTicketAndComment; use base RT::Action::AutoOpen; sub Commit { my $self = shift; my $oldstatus = $self->TicketObj->Status(); $self->TicketObj->__Set( Field => 'Status', Value => 'open' ); $self->TicketObj->_NewTransaction( Type => 'Status', Field=> 'Status', OldValue => $oldstatus, NewValue => 'open', Data => $self->Argument, ); $self->TicketObj->Comment( Content => $self->Argument, ); return(1); } =head1 DESCRIPTION A slight modification to the AutoOpen action, so that we can change the Transaction 'Data' field and Comment on the ticket. =head1 AUTHOR Tom Lanyon =cut 1; ___ http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users Community help: http://wiki.bestpractical.com Commercial support: [EMAIL PROTECTED] Discover RT's hidden secrets with RT Essentials from O'Reilly Media. Buy a copy at http://rtbook.bestpractical.com