Re: [rt-users] RT 4.0.2 too much CPU hungry !
Dear bart, thanks for you suggestion but still RT is too slow. In the log i have a lot of warnings like: [Thu Oct 13 08:33:41 2011] [warning]: Use of uninitialized value $location in regexp compilation at /usr/local/share/perl/5.10.1/Plack/Handler/Apache2.pm line 105. (/usr/local/share/perl/5.10.1/Plack/Handler/Apache2.pm:101) Any hint ? Michele On 11/10/2011 12:34, Bart wrote: Difficult to say. We run RT 4.0.2 on a Debian 6 environment as well (manual installation, manual perl dependency installation via cpan, etc.) The only thing I see in your posted config is an error in the way your plugins are included: -- Michele Pinassi Servizio Reti, Sistemi e Sicurezza Informatica Università degli Studi di Siena tel: 0577.(23)2169 https://sites.google.com/a/unisi.it/o-zone/ signature.asc Description: OpenPGP digital signature RT Training Sessions (http://bestpractical.com/services/training.html) * San Francisco, CA, USA October 18 19, 2011 * Washington DC, USA October 31 November 1, 2011 * Barcelona, Spain November 28 29, 2011
Re: [rt-users] RT 4.0.2 too much CPU hungry !
There was a problem in RT 4.0 with JS minify. I think it was fixed in 4.0.2 though. You can search for js minify in the mailing list and try it. Hope this helps. Hugs. 2011/10/13 Michele Pinassi michele.pina...@unisi.it: Dear bart, thanks for you suggestion but still RT is too slow. In the log i have a lot of warnings like: [Thu Oct 13 08:33:41 2011] [warning]: Use of uninitialized value $location in regexp compilation at /usr/local/share/perl/5.10.1/Plack/Handler/Apache2.pm line 105. (/usr/local/share/perl/5.10.1/Plack/Handler/Apache2.pm:101) Any hint ? Michele On 11/10/2011 12:34, Bart wrote: Difficult to say. We run RT 4.0.2 on a Debian 6 environment as well (manual installation, manual perl dependency installation via cpan, etc.) The only thing I see in your posted config is an error in the way your plugins are included: -- Michele Pinassi Servizio Reti, Sistemi e Sicurezza Informatica Università degli Studi di Siena tel: 0577.(23)2169 https://sites.google.com/a/unisi.it/o-zone/ RT Training Sessions (http://bestpractical.com/services/training.html) * San Francisco, CA, USA — October 18 19, 2011 * Washington DC, USA — October 31 November 1, 2011 * Barcelona, Spain — November 28 29, 2011 -- Sergio Roberto Charpinel Jr. RT Training Sessions (http://bestpractical.com/services/training.html) * San Francisco, CA, USA October 18 19, 2011 * Washington DC, USA October 31 November 1, 2011 * Barcelona, Spain November 28 29, 2011
Re: [rt-users] Custom Status 4.0.2
Ummm. yeah, not sure why I left it there either... Thanks for the second eye and the help, all is well now. Thanks, Randy -Original Message- From: ruslan.zaki...@gmail.com on behalf of Ruslan Zakirov Sent: Wed 10/12/2011 2:49 PM To: Randy Black Cc: RT users Subject: Re: [rt-users] Custom Status 4.0.2 Hi, Just delete first Set(%Lifecycles, ...); call and leave second one. First call you have is totally incorrect and messes things. I don't know why you left it there. On Wed, Oct 12, 2011 at 11:22 PM, Randy Black randy.bl...@buckle.com wrote: attached,. Thanks! -Original Message- From: ruslan.zaki...@gmail.com on behalf of Ruslan Zakirov Sent: Wed 10/12/2011 2:18 PM To: Randy Black Cc: RT users Subject: Re: [rt-users] Custom Status 4.0.2 Hi, Ok. Syntax is ok, but you changed brackets and now things are not what RT expect them to be. Show you current config so I can help you. On Wed, Oct 12, 2011 at 10:51 PM, Randy Black randy.bl...@buckle.com wrote: ok, i copied and pasted just as it was explained, I then restarted Apache and then compiling failed... not sure where to go from here. Do the values from the RT_Config need commented out or does the RT_SiteConfig override those settings? here is what happened, if you need to see the full config, let me know. Randy [root@localhost etc]# vi RT_SiteConfig.pm [root@localhost etc]# `perl -c etc/RT_SiteConfig.pm` Can't open perl script etc/RT_SiteConfig.pm: No such file or directory [root@localhost etc]# `perl -c /apps/rt4/etc/RT_SiteConfig.pm` /apps/rt4/etc/RT_SiteConfig.pm syntax OK [root@localhost etc]# /etc/init.d/httpd restart Stopping httpd: [ OK ] Starting httpd: [Wed Oct 12 18:47:13 2011] [warning]: (in cleanup) Error while loading /apps/rt4/sbin/rt-server: Not a HASH reference at /apps/rt4/sbin/../lib/RT/Lifecycle.pm line 620. Compilation failed in require at /apps/rt4/sbin/../lib/RT/Queue.pm line 161. Compilation failed in require at /apps/rt4/sbin/../lib/RT/Scrip.pm line 72. BEGIN failed--compilation aborted at /apps/rt4/sbin/../lib/RT/Scrip.pm line 72. Compilation failed in require at /apps/rt4/sbin/../lib/RT/Scrips.pm line 72. BEGIN failed--compilation aborted at /apps/rt4/sbin/../lib/RT/Scrips.pm line 72. Compilation failed in require at /apps/rt4/sbin/../lib/RT/Transaction.pm line 82. BEGIN failed--compilation aborted at /apps/rt4/sbin/../lib/RT/Transaction.pm line 82. Compilation failed in require at /apps/rt4/sbin/../lib/RT/Transactions.pm line 73. BEGIN failed--compilation aborted at /apps/rt4/sbin/../lib/RT/Transactions.pm line 73. Compilation failed in require at /apps/rt4/sbin/../lib/RT/Record.pm line 1492. BEGIN failed--compilation aborted at /apps/rt4/sbin/../lib/RT/Record.pm line 1492. Compilation failed in require at (eval 83) line 3. ...propagated at /usr/share/perl5/base.pm line 94. BEGIN failed--compilation aborted at /apps/rt4/sbin/../lib/RT/User.pm line 70. Compilation failed in require at (eval 82) line 3. ...propagated at /usr/share/perl5/base.pm line 94. BEGIN failed--compilation aborted at /apps/rt4/sbin/../lib/RT/CurrentUser.pm line 97. Compilation failed in require at /apps/rt4/sbin/../lib/RT/Handle.pm line 238. (/apps/rt4/sbin/../lib/RT.pm:342) [Wed Oct 12 13:47:13 2011] [error] (EAI 2)Name or service not known: Failed to resolve server name for 10.0.1.153 (check DNS) -- or specify an explicit ServerName [ OK ] -Original Message- From: ruslan.zaki...@gmail.com on behalf of Ruslan Zakirov Sent: Wed 10/12/2011 12:21 PM To: Randy Black Cc: RT users Subject: Re: [rt-users] Custom Status 4.0.2 On Wed, Oct 12, 2011 at 4:58 PM, Randy Black randy.bl...@buckle.com wrote: Hi Ruslan, Hello, That's a good question. I would be pleased to use the defaults. I had limited exposure to RT 3.x and brand new to RT4 as a sys admin. My main goal is to add just a few statuses and a spam action. I went to the training in Chicago, but I'm afraid I must have not been caffeinated enough or over caffinated when we went over that section... How do I add InProgress and WaitingOnClient to the statuses and a spam action? You keep Ccing rt-users@ mailing list so other people can help you %) First of all, open RT_Config.pm that is, as well, in etc dir. Copy default %Lifecycle setting from it into RT_SiteConfig.pm starting from Set(%Lifecycles, ending with );. Restart your server to make sure it worked or run `perl -c etc/RT_SiteConfig.pm` to make sure syntax is ok even before restarting server. Then you can add new statuses. You probably need active = [...], line. Then for new statuses you add allowed transitions. And so on. Just make sure every bracket and quote character is balanced. If you don't trust your changes, check syntax with above command after every change. Thanks much
Re: [rt-users] help with ModifyQuery callback
1. This was within a 'simple perl program' outside of RT. I already answered what happens: print $$query results in undefined variable error (because using strict). print $query prints search term. This is completely independent from ModifyQuery, and as I said, I have tried using BOTH $query and $$query in ModifyQuery and it is not working, in fact SimpleSearch quits working altogether. I got the code from places in the wiki which automagically double scalars. I have done the same thing with the SkipTransaction Callback and it works. http://requesttracker.wikia.com/wiki/SimpleSearchExcludeResolved and you didn't have anything to say in this user's request on why it doesn't do anything either: http://www.gossamer-threads.com/lists/rt/users/98262 which also touches on the $RT::Logger not working in his callback, if I could get that to work, I wouldn't be bothering everyone here. 2. Management wants it this way...they are not going to be searching for queue:General or using any other nice utilities you have put into RT, if they were, they wouldn't mind type fulltext: before the search term. 3. I'll look at the Googleish.pm, but I bet I will have just as many questions...hopefully not. I was putting this in a callback to avoid any conflicts in patching the RT app in the future. -Original Message- From: rt-users-boun...@lists.bestpractical.com [mailto:rt-users-boun...@lists.bestpractical.com] On Behalf Of Kevin Falcone Sent: Wednesday, October 12, 2011 5:38 PM To: rt-users@lists.bestpractical.com Subject: Re: [rt-users] help with ModifyQuery callback On Wed, Oct 12, 2011 at 03:41:58PM -0500, Izz Abdullah wrote: And I have tried with just $query...I wrote the silly program though and received what I expected, an error for an undefined variable. If I change the print line to print $query; If print $query works, why are you using $$query on the right of an assignment? go print $$query and see what you get. I have been using the double $ because that is all I could find on the net...no one here has given me any other guidance on this issue. The correct way to do this is to avoid hacking things onto the string (what happens when I use the syntax available to do queue:General, are you going to transform that to fulltext:queue:General?) lib/RT/Search/Googleish.pm has been massively refactored and contains a number of small subroutines available for overriding that affect the way that the default parsing is done. You could do this with in a much less fragile manner by looking at that code and overriding the default parsing one. -kevin RT Training Sessions (http://bestpractical.com/services/training.html) * San Francisco, CA, USA October 18 19, 2011 * Washington DC, USA October 31 November 1, 2011 * Barcelona, Spain November 28 29, 2011
Re: [rt-users] help with ModifyQuery callback
On Thu, Oct 13, 2011 at 08:40:51AM -0500, Izz Abdullah wrote: and you didn't have anything to say in this user's request on why it doesn't do anything either: http://www.gossamer-threads.com/lists/rt/users/98262 I can't answer every question on the mailing list. That question is also from a year ago and a different version of RT. which also touches on the $RT::Logger not working in his callback, if I could get that to work, I wouldn't be bothering everyone here. A trivial Logger call in that callback works fine: transom:rt4.0.2 root# mkdir -p local/html/Callbacks/Hi/Search/Simple.html/ transom:rt4.0.2 root# vim local/html/Callbacks/Hi/Search/Simple.html/ModifyQuery transom:rt4.0.2 root# cat local/html/Callbacks/Hi/Search/Simple.html/ModifyQuery % RT-Logger-error(Hi) transom:rt4.0.2 root# ./sbin/standalone_httpd HTTP::Server::PSGI: Accepting connections at http://0:8992/ [Thu Oct 13 14:24:19 2011] [info]: Successful login for root from 127.0.0.1 (/opt/rt4.0.2/sbin/../lib/RT/Interface/Web.pm:660) [Thu Oct 13 14:24:19 2011] [error]: Hi (/opt/rt4.0.2/local/html/Callbacks/Hi/Search/Simple.html/ModifyQuery:1) -kevin pgpBaSjuwhsc6.pgp Description: PGP signature RT Training Sessions (http://bestpractical.com/services/training.html) * San Francisco, CA, USA October 18 19, 2011 * Washington DC, USA October 31 November 1, 2011 * Barcelona, Spain November 28 29, 2011
Re: [rt-users] help with ModifyQuery callback
Well it doesn't work for me in this callback. And you did put your 2 cents worth in at the end of that particular thread. Yes, it was over a year ago, but there isn't much literature, except for help from colleagues here, on the ModifyQuery syntax. Which I am not really getting a lot of help...just 'why did you do this'. I have tried multiple ways. And am still working on multiple ways, and emailing the list in the midst of trying different approaches. I have even tried the noted: $$query = $$query . new open resolved stalled rejected deleted; (which seemed to work for other users) Direction is appreciated. -Original Message- From: rt-users-boun...@lists.bestpractical.com [mailto:rt-users-boun...@lists.bestpractical.com] On Behalf Of Kevin Falcone Sent: Thursday, October 13, 2011 9:25 AM To: rt-users@lists.bestpractical.com Subject: Re: [rt-users] help with ModifyQuery callback On Thu, Oct 13, 2011 at 08:40:51AM -0500, Izz Abdullah wrote: and you didn't have anything to say in this user's request on why it doesn't do anything either: http://www.gossamer-threads.com/lists/rt/users/98262 I can't answer every question on the mailing list. That question is also from a year ago and a different version of RT. which also touches on the $RT::Logger not working in his callback, if I could get that to work, I wouldn't be bothering everyone here. A trivial Logger call in that callback works fine: transom:rt4.0.2 root# mkdir -p local/html/Callbacks/Hi/Search/Simple.html/ transom:rt4.0.2 root# vim local/html/Callbacks/Hi/Search/Simple.html/ModifyQuery transom:rt4.0.2 root# cat local/html/Callbacks/Hi/Search/Simple.html/ModifyQuery % RT-Logger-error(Hi) transom:rt4.0.2 root# ./sbin/standalone_httpd HTTP::Server::PSGI: Accepting connections at http://0:8992/ [Thu Oct 13 14:24:19 2011] [info]: Successful login for root from 127.0.0.1 (/opt/rt4.0.2/sbin/../lib/RT/Interface/Web.pm:660) [Thu Oct 13 14:24:19 2011] [error]: Hi (/opt/rt4.0.2/local/html/Callbacks/Hi/Search/Simple.html/ModifyQuery:1) -kevin RT Training Sessions (http://bestpractical.com/services/training.html) * San Francisco, CA, USA October 18 19, 2011 * Washington DC, USA October 31 November 1, 2011 * Barcelona, Spain November 28 29, 2011
Re: [rt-users] help with ModifyQuery callback
On Thu, Oct 13, 2011 at 09:48:59AM -0500, Izz Abdullah wrote: Well it doesn't work for me in this callback. If my trivial example does not work for you, then something is fundamentally broken with your RT install. Stop trying to make your changes to the query until you can get my example to run. -kevin A trivial Logger call in that callback works fine: transom:rt4.0.2 root# mkdir -p local/html/Callbacks/Hi/Search/Simple.html/ transom:rt4.0.2 root# vim local/html/Callbacks/Hi/Search/Simple.html/ModifyQuery transom:rt4.0.2 root# cat local/html/Callbacks/Hi/Search/Simple.html/ModifyQuery % RT-Logger-error(Hi) transom:rt4.0.2 root# ./sbin/standalone_httpd HTTP::Server::PSGI: Accepting connections at http://0:8992/ [Thu Oct 13 14:24:19 2011] [info]: Successful login for root from 127.0.0.1 (/opt/rt4.0.2/sbin/../lib/RT/Interface/Web.pm:660) [Thu Oct 13 14:24:19 2011] [error]: Hi (/opt/rt4.0.2/local/html/Callbacks/Hi/Search/Simple.html/ModifyQuery:1) pgpi9yhPBdbbH.pgp Description: PGP signature RT Training Sessions (http://bestpractical.com/services/training.html) * San Francisco, CA, USA October 18 19, 2011 * Washington DC, USA October 31 November 1, 2011 * Barcelona, Spain November 28 29, 2011
Re: [rt-users] help with ModifyQuery callback
That's another thing. Your logger looks different from what I have seen. Yours: RT-Logger-error(Hi) What I have seen: $RT::Logger-error(Hi); Yours doesn't have a semicolon and is called differently, or is it essentially called the same? -Original Message- From: rt-users-boun...@lists.bestpractical.com [mailto:rt-users-boun...@lists.bestpractical.com] On Behalf Of Kevin Falcone Sent: Thursday, October 13, 2011 10:03 AM To: rt-users@lists.bestpractical.com Subject: Re: [rt-users] help with ModifyQuery callback On Thu, Oct 13, 2011 at 09:48:59AM -0500, Izz Abdullah wrote: Well it doesn't work for me in this callback. If my trivial example does not work for you, then something is fundamentally broken with your RT install. Stop trying to make your changes to the query until you can get my example to run. -kevin A trivial Logger call in that callback works fine: transom:rt4.0.2 root# mkdir -p local/html/Callbacks/Hi/Search/Simple.html/ transom:rt4.0.2 root# vim local/html/Callbacks/Hi/Search/Simple.html/ModifyQuery transom:rt4.0.2 root# cat local/html/Callbacks/Hi/Search/Simple.html/ModifyQuery % RT-Logger-error(Hi) transom:rt4.0.2 root# ./sbin/standalone_httpd HTTP::Server::PSGI: Accepting connections at http://0:8992/ [Thu Oct 13 14:24:19 2011] [info]: Successful login for root from 127.0.0.1 (/opt/rt4.0.2/sbin/../lib/RT/Interface/Web.pm:660) [Thu Oct 13 14:24:19 2011] [error]: Hi (/opt/rt4.0.2/local/html/Callbacks/Hi/Search/Simple.html/ModifyQuery:1 ) RT Training Sessions (http://bestpractical.com/services/training.html) * San Francisco, CA, USA October 18 19, 2011 * Washington DC, USA October 31 November 1, 2011 * Barcelona, Spain November 28 29, 2011
Re: [rt-users] help with ModifyQuery callback
And you haven't set any permissions on the file...does that matter? -Original Message- From: Izz Abdullah Sent: Thursday, October 13, 2011 10:13 AM To: 'rt-users@lists.bestpractical.com' Subject: RE: [rt-users] help with ModifyQuery callback That's another thing. Your logger looks different from what I have seen. Yours: RT-Logger-error(Hi) What I have seen: $RT::Logger-error(Hi); Yours doesn't have a semicolon and is called differently, or is it essentially called the same? -Original Message- From: rt-users-boun...@lists.bestpractical.com [mailto:rt-users-boun...@lists.bestpractical.com] On Behalf Of Kevin Falcone Sent: Thursday, October 13, 2011 10:03 AM To: rt-users@lists.bestpractical.com Subject: Re: [rt-users] help with ModifyQuery callback On Thu, Oct 13, 2011 at 09:48:59AM -0500, Izz Abdullah wrote: Well it doesn't work for me in this callback. If my trivial example does not work for you, then something is fundamentally broken with your RT install. Stop trying to make your changes to the query until you can get my example to run. -kevin A trivial Logger call in that callback works fine: transom:rt4.0.2 root# mkdir -p local/html/Callbacks/Hi/Search/Simple.html/ transom:rt4.0.2 root# vim local/html/Callbacks/Hi/Search/Simple.html/ModifyQuery transom:rt4.0.2 root# cat local/html/Callbacks/Hi/Search/Simple.html/ModifyQuery % RT-Logger-error(Hi) transom:rt4.0.2 root# ./sbin/standalone_httpd HTTP::Server::PSGI: Accepting connections at http://0:8992/ [Thu Oct 13 14:24:19 2011] [info]: Successful login for root from 127.0.0.1 (/opt/rt4.0.2/sbin/../lib/RT/Interface/Web.pm:660) [Thu Oct 13 14:24:19 2011] [error]: Hi (/opt/rt4.0.2/local/html/Callbacks/Hi/Search/Simple.html/ModifyQuery:1 ) RT Training Sessions (http://bestpractical.com/services/training.html) * San Francisco, CA, USA October 18 19, 2011 * Washington DC, USA October 31 November 1, 2011 * Barcelona, Spain November 28 29, 2011
Re: [rt-users] Looking up queues by name in cli: How to handle spaces in names?
On Wed, Oct 12, 2011 at 08:37:30PM +0200, tobiasbp wrote: I'm running RT 3.8.8 on Debian. Using the cli I need to get information on queues. I can look up queues with no spaces in their name, but I can't figure out to handle queues with spaces in their names. Looking up the queue queue_name works: rt show -t queue some_queue I can't figure out how to look up the queue queue name. I have tried the below without success: rt show -t queue some\ queue rt show -t queue 'some queue' rt show -t queue some%20queue I get the error: rt: show: Unrecognised argument 'queue name'. rt: show: No objects specified. rt: For help, run 'rt help show'. rt: For help, run 'rt help queue'. That sounds like a bug. Would you file something in the bugtracker? The only workaround I can see without code changes is using the queue's ID. -kevin pgpHbG9UtcQ7d.pgp Description: PGP signature RT Training Sessions (http://bestpractical.com/services/training.html) * San Francisco, CA, USA October 18 19, 2011 * Washington DC, USA October 31 November 1, 2011 * Barcelona, Spain November 28 29, 2011
Re: [rt-users] Accessing custom fields of type Ticket Transactions using CLI?
On Wed, Oct 12, 2011 at 08:48:53PM +0200, tobiasbp wrote: I need to look up up values for custom fields of type Ticket Transactions. Using the query below, I can see the full ticket history, but the custom field on transactions does not show up: rt show -l 103/history I'm using RT 3.8.8 on Debian. Looks like share/html/REST/1.0/Forms/ticket/history would need updating to print those out. Please file a bug -kevin pgpeVb1nkF3D9.pgp Description: PGP signature RT Training Sessions (http://bestpractical.com/services/training.html) * San Francisco, CA, USA October 18 19, 2011 * Washington DC, USA October 31 November 1, 2011 * Barcelona, Spain November 28 29, 2011
Re: [rt-users] Looking up queues by name in cli: How to handle spaces in names?
The only workaround I can see without code changes is using the queue's ID. I would love to do that, but looking at a ticket I can not see the ID of the queue, just the name: rt show -l 103 id: ticket/103 Queue: queue name Since I can't show queue name with the rt command I don't see how I can get information on the queue? Regards, Tobias RT Training Sessions (http://bestpractical.com/services/training.html) * San Francisco, CA, USA October 18 19, 2011 * Washington DC, USA October 31 November 1, 2011 * Barcelona, Spain November 28 29, 2011
Re: [rt-users] Looking up queues by name in cli: How to handle spaces in names?
On Thu, Oct 13, 2011 at 05:52:57PM +0200, tobiasbp wrote: The only workaround I can see without code changes is using the queue's ID. I would love to do that, but looking at a ticket I can not see the ID of the queue, just the name: rt show -l 103 id: ticket/103 Queue: queue name Since I can't show queue name with the rt command I don't see how I can get information on the queue? Then you'll need to wait on a bugfix I guess, or use the perl API which doesn't have this limitation. Please do file the bug so we don't forget it. -kevin pgppvra3McFOP.pgp Description: PGP signature RT Training Sessions (http://bestpractical.com/services/training.html) * San Francisco, CA, USA October 18 19, 2011 * Washington DC, USA October 31 November 1, 2011 * Barcelona, Spain November 28 29, 2011
[rt-users] Sorting transactions by id instead of Created?
Hi, I'm wondering if there is any place in the code (anyone knows of) where database selects from the 'Transactions' table might be ordered by id instead of the Created date column? I'm trying to fix Create entries in the database by adding a new entry 1 second ahead then changing the initial Create to the Comment type. This is working fine, but in case there's a known place in the code where ordering is done by id, this will break idea. Lars RT Training Sessions (http://bestpractical.com/services/training.html) * San Francisco, CA, USA October 18 19, 2011 * Washington DC, USA October 31 November 1, 2011 * Barcelona, Spain November 28 29, 2011
[rt-users] Scrip chaining
If, in the custom action for the On Create scrip of queue A, I resolve the ticket and change the queue to B, which runs? ? The On Resolve scrip for queue A ? The On Resolve scrip for queue B ? Both ? Neither ? It depends on the order of the resolve and the close in the 'On Create' scrip. And is this, whatever the answer is, something I can depend upon? Many thanks, John RT Training Sessions (http://bestpractical.com/services/training.html) * San Francisco, CA, USA October 18 19, 2011 * Washington DC, USA October 31 November 1, 2011 * Barcelona, Spain November 28 29, 2011
[rt-users] REST queries/search for queue objects in 4.0.2
I see that the REST APIs has a search method to do search for tickets based on some conditions (Request: /REST/1.0/search/ticket?query=queryorderby=sort-orderformat=format). Is there an equivalent one for the Queue object? When I tried it I got error… Following is query string: /REST/1.0/search/queue?query= Name = 'My Special Queue' And the response is == (RT/4.0.2 500 Server Error. Unsupported object type) Is there a way to query/search non ticket objects using conditions? Thanks RT Training Sessions (http://bestpractical.com/services/training.html) * San Francisco, CA, USA October 18 19, 2011 * Washington DC, USA October 31 November 1, 2011 * Barcelona, Spain November 28 29, 2011
[rt-users] RT 4.0.2: Custom Condition Fails
List, I recently created a custom condition to match tickets created after hours so that I could use it in a scrip to send a copy of the ticket information to the on-call Support Desk tech. I first tested it successfully on an old RT 3.8.8 installation and then started testing it in my RT 4.0.2 installation. I get the following error: Oct 13 22:20:57 rt2 RT: Scrip IsApplicable 14 died. - Can't locate object method new via package RT::Condition::OnAfterHoursCreate at /usr/local/rt/sbin/../lib/RT/ScripCondition.pm line 173. Stack: [/usr/local/rt/sbin/../lib/RT/ScripCondition.pm:173] [/usr/local/rt/sbin/../lib/RT/Scrip.pm:404] [/usr/local/rt/sbin/../lib/RT/Scrips.pm:225] [/usr/local/rt/sbin/../lib/RT/Transaction.pm:179] [/usr/local/rt/sbin/../lib/RT/Record.pm:1447] [/usr/local/rt/sbin/../lib/RT/Ticket.pm:669] [/usr/local/rt/sbin/../lib/RT/Interface/Web.pm:1389] [/usr/local/rt/share/html/Ticket/Display.html:127] [/usr/local/rt/share/html/Ticket/Create.html:444] [/usr/local/rt/sbin/../lib/RT/Interface/Web.pm:538] [/usr/local/rt/sbin/../lib/RT/Interface/Web.pm:285] [/usr/local/rt/share/html/autohandler:53] (/usr/local/rt/sbin/../lib/RT/Scrip.pm:419) The name of the custom condition is OnAfterHoursCreate and it is located under myRtRoot/local/lib/RT/Condition/. What's odd is that when I look at the system condition modules, I don't see a new() method defined so I'm not sure why this error is occuring for me. For reference, this is the code for the custom condition: package RT::Condition::OnAfterHoursCreate; use warnings; use strict; use base 'RT::Condition'; sub IsApplicable { my $self = shift; my $weekday = (localtime)[6]; my $min = (localtime)[1]; my $hour = (localtime)[2]; return 1 if $weekday == 6 || $weekday == 0; return 1 if $hour = 17 || ( $hour = 8 $min = 29); return 0; # no match } 1; I used the following Perl script to register the condition within RT: #!/usr/bin/perl use strict; use lib /usr/local/rt/lib; use RT; use RT::Interface::CLI qw( CleanEnv GetCurrentUser ); use RT::ScripCondition; CleanEnv(); RT::LoadConfig(); RT::Init(); my $user = GetCurrentUser(); unless( $user-Id ) { print No RT user found. Please consult your RT administrator.\n; exit 1; } my $sc = RT::ScripCondition-new($user); $sc-Create( Name = 'On After Hours Create', Description = 'A ticket is created after hours', ExecModule = 'OnAfterHoursCreate', ApplicableTransTypes = 'Create', ); I built the custom condition and registration code from an example I found in the 'RT Essentials' book published by O'Reilly. In fact, it's a 99% lift from that book. The only difference I noted that was required for custom conditions in RT 4 was the need to change use base 'RT::Condition:Generic'; to use base 'RT::Condition';. Am I missing something in general? Or am I missing something specific to RT 4? Ryan RT Training Sessions (http://bestpractical.com/services/training.html) * San Francisco, CA, USA October 18 19, 2011 * Washington DC, USA October 31 November 1, 2011 * Barcelona, Spain November 28 29, 2011