[rt-users] RESOLVED: Re: Custom scrip: Ticket created, but commit fails.

Charles Johnson charles.johnson at accre.vanderbilt.edu
Tue Jun 29 14:25:21 EDT 2010


Pardon the top posting, but I feel that I have worked around the  
problem we had with failing commits on ticket creation. Here is what I  
did.

We first upgraded to the latest stable version of mod_perl for CentOS  
5.2.

Second, we changed to custom cleanup code to use IPC::System::Simple  
and usied a systemx() call, rather than system(). The advantage is  
that systemx() does not invoke a new shell and swallows all stdout/ 
stderr and return values from the invoked binary. This seems to keep  
mod_perl happy as well as RT. Here is the new custom cleanup code:

{
    use IPC::System::Simple qw(system systemx);
    my $myId       = $self->TicketObj->EffectiveId;
    my $mySubject  = $self->TicketObj->Subject;

    my $binret = '';
    my $binary = '/home/alarmpoint/alarmpointsystems/integrationagent/ 
bin/APClient.bin';

    $binret = systemx($binary, '--map-data', 'vanderbilt', 'Cluster  
Group', $mySubject, 'RT', "RT $myId");

   1;
}

I hope this helps someone else. It works for us.

Cheers--

Charles

On Jun 24, 2010, at 2:38 PM, Kevin Falcone wrote:

> On Thu, Jun 24, 2010 at 11:19:00AM -0500, Charles Johnson wrote:
>> Badly needing help. This is a script to call a binary that sends
>> data to a webservice. The binary simply accepts the data and
>> returns.
>>
>> rt version: 3.8.1
>> OS version CentOS 5.2
>
> If you're using mod_perl, Ruslan found some really excellent bugs with
> running system commands under it.  If you can come up to 3.8.8, that
> may fix it for you
>
> -kevin
>
>> First, here is the error message:
>>
>> Jun 24 10:51:32 helpdesk RT: Ticket 9261 created in queue
>> 'ClusterSupport' by johns276
>> (/opt/rt3/bin/../lib/RT/Ticket_Overlay.pm:659)
>> Jun 24 10:51:32 helpdesk RT: Attempted to commit a transaction with
>> none in progress at
>> /usr/lib/perl5/site_perl/5.8.8/DBIx/SearchBuilder/Handle.pm line 747
>> 	DBIx
>> ::SearchBuilder::Handle::EndTransaction('RT::Handle=HASH(0xba695a0)',
>> 'Action', 'commit', 'Force', 'undef') called at /usr/lib/perl5/
>> site_perl/5.8.8/DBIx/SearchBuilder/Handle.pm line 780 	
>> DBIx::SearchBuilder::Handle::Commit('RT::Handle=HASH(0xba695a0)')
>> called at /opt/rt3/bin/../lib/RT/Ticket_Overlay.pm line 675 	
>> RT::Ticket::Create('RT::Ticket=HASH(0xc8b8798)', 'Requestor',
>> 'ARRAY(0xc8a4df4)', 'DependsOn', 'ARRAY(0xc8bb6b8)', 'Cc',
>> 'ARRAY(0xc8c1034)', 'RefersTo', 'ARRAY(0xc8bb7f0)', ...) called at /
>> opt/rt3/bin/../local/lib/RT/Interface/Email/Filter/TakeAction.pm
>> line 501 	
>> RT::Interface::Email::Filter::TakeAction::GetCurrentUser('Message',
>> 'MIME::Entity=HASH(0xc8af7fc)', 'RawMessageRef',
>> 'SCALAR(0xc8afdc0)', 'CurrentUser',
>> 'RT::CurrentUser=HASH(0xc862d80)', 'AuthLevel', 1, 'Action', ...)
>> called at /opt/rt3/bin/../lib/RT/Interface/Email.pm line 1274 	RT::
>>
>> The ticket is created but the commit fails. An attempt to view the
>> ticket produces this error message: "Could not load ticket 9261"
>>
>> Here is the scrip. It is attached to a particular queue
>> (CustomerSupport).
>>
>> # Condition: User defined
>> if ($self->TransactionObj->Type eq 'Create')  {
>>     return (1);
>> }
>>
>> # Action: User Defined
>> # Custom action preparation code: Do nothing with the ticket
>> 1;
>>
>> # Custom action cleanup code:
>> {
>>   my $myId       = $self->TicketObj->EffectiveId;
>>   my $mySubject  = $self->TicketObj->Subject;
>>
>>   my $binary =
>> '/home/alarmpoint/alarmpointsystems/integrationagent/
>> bin/APClient.bin';
>>   system($binary, '--map-data', 'vanderbilt', 'Cluster Group',
>> $mySubject, 'RT', "RT $myId");
>>
>>  1;
>> }
>>
>> #Template: Global Template: Blank
>>
>> Any suggestions would be appreciated. The message is actually send
>> to the webservice, since we can log in to the remote server and see
>> that the data was sent appropriately. However, RT balks.
>>
>> Thanks.
>>
>> ~Charles~
>>
>> --
>> Charles Johnson, Vanderbilt University
>> Advanced Computing Center for Research and Education
>> Office: 615-343-4134
>> Cell: 615-478-5743
>>
>> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
>> Buy a copy at http://rtbook.bestpractical.com
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com

--
Charles Johnson, Vanderbilt University
Advanced Computing Center for Research & Education
Mailing Address:  Peabody #34, 230 Appleton Place, Nashville, TN 37203
Shipping Address: 1231 18th Avenue South, Hill Center, Suite 143,  
Nashville, TN 37212
Office: 615-343-4134
Cell: 615-478-5743
Fax: 615-343-7216




More information about the rt-users mailing list