I’m having some issues getting a scrip I wrote to run in RT 4.2.2. I am
attempting to populate some custom fields from XML in an email submitted
ticket but in the process of troubleshooting, I noticed that the scrip
itself was not being traversed when email tickets are being submitted. The
tickets are created and the autoreply goes out just fine, but my scrip with
the same On Create condition does not execute. These are the debug logs
showing the scrips that run On Create and the code for my custom Scrip,
which is number 16.
Debug Logs:*
/Feb 11 16:16:30 vector RT: [22799]
rt-4.2.2-22799-1392153390-1915.105-7-0@example.com #105/703 - Scrip 7 On
Create Autoreply To Requestors
Feb 11 16:16:30 vector RT: [22799]
rt-4.2.2-22799-1392153390-1915.105-7-0@example.com sent To:
Feb 11 16:16:30 vector RT: [22799]
rt-4.2.2-22799-1392153390-491.105-8-0@example.com #105/703 - Scrip 8 On
Create Notify Owner and AdminCcs
Feb 11 16:16:30 vector RT: [22799]
rt-4.2.2-22799-1392153390-491.105-8-0@example.com No recipients found. Not
sending.
Feb 11 16:16:30 vector RT: [22799]
rt-4.2.2-22799-1392153390-683.105-9-0@example.com #105/703 - Scrip 9 On
Create Notify Ccs
Feb 11 16:16:30 vector RT: [22799]
rt-4.2.2-22799-1392153390-683.105-9-0@example.com No recipients found. Not
sending.
Feb 11 16:16:30 vector RT: [22799]
rt-4.2.2-22799-1392153390-172.105-10-0@example.com #105/703 - Scrip 10 On
Create Notify Other Recipients
Feb 11 16:16:30 vector RT: [22799]
rt-4.2.2-22799-1392153390-172.105-10-0@example.com No recipients found.
Not sending.
Feb 11 16:16:30 vector RT: [22799] Ticket 105 created in queue ‘DMCA’ by
**************/
Scrip:
Conditon: On Create
Action: User Defined
Template: Blank
User Defined Conditions and Results:
Custom Conditon:
Custom Action Preperation Code: /return 1;/
Custom Action Commit Code:
/# Get the current transaction and ticket objects
my $transaction = $self->TransactionObj;
my $ticket = $self->TicketObj;
Create the Custom Field and specify the name
my $cf_obj = RT::CustomField->new($RT::SystemUser);
my $cf_name = “Case ID”;
my $content = $transaction->Content;
my $cf_value = $content =~ /(.*)</ID>/;
RT::Logger->debug($cf_value);
#RT::Logger->debug($cf_obj->Name);
$cf_obj->LoadByName(Name=>$cf_name);
$ticket->AddCustomFieldValue(Field=>$cf_obj, Value=>$cf_value);
return 1;
/
I have tried to simply put “return 1;” in both the prep and commit code and
still haven’t had any luck getting this scrip to run. I am not really
concerned with the parsing logic at this point, I would just like to get it
to trigger On Create. Here is the alias I am using to submit my tickets via
the local PostFix install:
/dmcanotices: “|/opt/rt4/bin/rt-mailgate --queue DMCA --action correspond
–url https://192.168.160.xxx”/
Any help anyone can provide would be greatly appreciated. I am entering day
3 of this issue, and I’m out of ideas.
View this message in context: http://requesttracker.8502.n7.nabble.com/User-Created-Scrip-Won-t-Run-On-Create-tp56616.html
I’m having some issues getting a scrip I wrote to run in RT 4.2.2. I am
attempting to populate some custom fields from XML in an email submitted
ticket but in the process of troubleshooting, I noticed that the scrip
itself was not being traversed when email tickets are being submitted. The
tickets are created and the autoreply goes out just fine, but my scrip with
the same On Create condition does not execute. These are the debug logs
showing the scrips that run On Create and the code for my custom Scrip,
which is number 16.
A deficiency in the RT logging infrastructure causes non-email-sending
Scrips to not be logged as well as those that send email.
Conditon: On Create
Action: User Defined
Template: Blank
User Defined Conditions and Results:
Custom Conditon:
Custom Action Preperation Code: /return 1;/
Custom Action Commit Code:
I have tried to simply put “return 1;” in both the prep and commit code and
still haven’t had any luck getting this scrip to run. I am not really
concerned with the parsing logic at this point, I would just like to get it
to trigger On Create. Here is the alias I am using to submit my tickets via
the local PostFix install:
Instead of putting return 1; which will cause the Scrip to do nothing,
make the Custom Action Prepare be
RT->Logger->error(“Preparing custom scrip”);
return1;
and a similar message in the commit, and ensure that the Condition is
On Create.
If you’re really not seeing error messages from that, then something
is quite wrong.
-kevin
I’ve seen examples online of people calling the logger using the
/RT::Logger->error command/, but you are recommending using
/RT->Logger->error/. Which of these is the correct way to call the logger?
I’ve been trying logging statements and neither of the methods above add
anything to the debug logs. In my RT_SiteConfig.pm, I have this statement:
/Set($LogToSyslog , ‘debug’);/
Does debug function as a catch all for error, info, critical, warning, etc.?
My Scrip is applied to the queue that I am sending to, and supposed to run
at the TransactionCreate Stage. At this point, I am fairly certain that I
have everything correct on the front end and I am starting to look for
issues in my web stack. I am using Apache 2.2.15-29 and mod_perl-2.0.4-10.
View this message in context: http://requesttracker.8502.n7.nabble.com/User-Created-Scrip-Won-t-Run-On-Create-tp56616p56640.html
I’ve seen examples online of people calling the logger using the
/RT::Logger->error command/, but you are recommending using
/RT->Logger->error/. Which of these is the correct way to call the logger?
They’re equivalent
I’ve been trying logging statements and neither of the methods above add
anything to the debug logs. In my RT_SiteConfig.pm, I have this statement:
/Set($LogToSyslog , ‘debug’);/
Does debug function as a catch all for error, info, critical, warning, etc.?
Yes.
My Scrip is applied to the queue that I am sending to, and supposed to run
at the TransactionCreate Stage. At this point, I am fairly certain that I
have everything correct on the front end and I am starting to look for
issues in my web stack. I am using Apache 2.2.15-29 and mod_perl-2.0.4-10.
A TransactionCreate Scrip with
On Create
User Defined
Blank
Custom Prepare
RT->Logger->error(“Preparing!”);
return 1;
Custom Commit
RT->Logger->error(“Committing!”);
return 1;
Logs my two messages to the log
[34474] [Thu Feb 13 16:17:06 2014] [error]: Preparing! ((eval 633):1)
[34474] [Thu Feb 13 16:17:06 2014] [error]: Committing! ((eval 637):1)
Since you’re running 4.2, go to Admin → Tools → System Configuration
and read the Logging box and ensure you’re reading the correct logs.
-kevin
Out of curiosity, I went in and changed the Syslog debugging variable to
‘error’ instead of ‘debug’ and then add these lines to the prep and commit
code of my script:
/RT::Logger->error(“Entering the prep phase”);
return 1;/
and
/RT::Logger->error(“Entering the Commit Phase”);/
Both showed up in //var/log/messages/!
/
Feb 13 11:29:29 vector RT: [30288] Entering the prep phase
Feb 13 11:29:29 vector RT: [30288] Entering the Commit Phase/
Debug does not seem to be catching these. Below is my Logging info from the
RT Configuration web page.
/RT’s logging configuration is summarized below:
Logging info level messages and higher to STDERR, which will usually end
up in your webserver’s error logs.
Logging error level messages and higher to syslog.
Stack traces are not logged.
SQL queries are not logged./
With this, I atleast know that I am getting past the condition on create and
entering the action. The logic I have doesn’t seem to be working for the
custom field population, but I think I can figure that out.
View this message in context: http://requesttracker.8502.n7.nabble.com/User-Created-Scrip-Won-t-Run-On-Create-tp56616p56644.html
Out of curiosity, I went in and changed the Syslog debugging variable to
‘error’ instead of ‘debug’ and then add these lines to the prep and commit
code of my script:
/RT::Logger->error(“Entering the prep phase”);
return 1;/
and
/RT::Logger->error(“Entering the Commit Phase”);/
Great - so your Scrip has been firing all along, your syslog
configuration was just wrong.
If you set $LogToSyslog to ‘debug’ look at what RT’s system
configuration page says. If it says “Logging debug level messages and
higher to syslog” then RT will hand all debug and higher messages off
to the sysload. However I find many syslogs are set to
‘exclude’ debug information. As best I can tell, your Scrip has
clearly been running the whole time.
-kevin
You were correct, Kevin. My script was running the whole time, I just
couldn’t see what I was doing wrong. Once I was able to see the logging
information, I was able to find the logical error I was making and I got my
XML parsing scrip up and running beautifully. Thank you for your help.
View this message in context: http://requesttracker.8502.n7.nabble.com/User-Created-Scrip-Won-t-Run-On-Create-tp56616p56709.html