[rt-users] how to access content for an attachment in scrip?

John Alberts John.Alberts at exlibrisgroup.com
Wed Jul 6 18:01:47 EDT 2011


Using the rt console, I can see that there are actually 3 attachments, even though the I only sent one and the web ui only shows 1, so I'm sure the problem is that I'm selecting the wrong attachment.

Here's what I see from the console.
./rt show 2075/attachments
19671: (Unnamed) (multipart/mixed / 0b),
19672: (Unnamed) (text/plain / 305b),
19673: env-vars.txt (application/octet-stream / 16.8k)


The attachment I would like will always be named env-vars.txt.  How can I get the contents for the attachment name env-vars.txt?

Thanks

John


From: John Alberts <john.alberts at exlibrisgroup.com<mailto:john.alberts at exlibrisgroup.com>>
Date: Wed, 6 Jul 2011 20:06:34 +0000
To: "rt-users at lists.bestpractical.com<mailto:rt-users at lists.bestpractical.com>" <rt-users at lists.bestpractical.com<mailto:rt-users at lists.bestpractical.com>>
Subject: [rt-users] how to access content for an attachment in scrip?

Hi. I'm trying to customize the scrip shown at the bottom of this wiki page: http://requesttracker.wikia.com/wiki/AutoCloseOnNagiosRecoveryMessages

I know there is an extension that does merging, but I want to do some other things with the Nagios variables I have attached as a plain text file to the ticket that Nagios creates in RT.
The first few lines in the scrip attempt to get the content of an attachment and put it in a variable named $content.  I suspected that this was not working, so I added a debug line to dump the contents of $contents and it is empty.

Here is the scrip code.
   my $T_Obj = $self->TicketObj;
   my $AttachObj = $self->TransactionObj->Attachments->First;
   my $content = $AttachObj->Content;
   $RT::Logger->debug("Contents: " . $content);


The log output shows:
[Wed Jul  6 19:47:49 2011] [debug]:  Contents: ((eval 3934):4)


The attachment is attached to the ticket.  I can see it in the web ui and can open and read it with no problems.  Any idea what I'm doing wrong here?


Thanks


John


-------- 2011 Training: http://bestpractical.com/services/training.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20110706/83918558/attachment.htm>


More information about the rt-users mailing list