[rt-users] rt shell script: can't create multi-line text in new ticket

Steve Switzer steve at switzersolutions.com
Thu Mar 6 00:46:36 EST 2008


Hello!
   I've been working on a script that checks to see if a ticket exists
for a certain problem, and if not, creates the ticket. I'm using bash
with bin/rt to script this, and have been struggling for a few hours
trying to get it just right. I have all my data in variables, and this
caused me trouble in the beginning... here's an example:

rt create -t ticket set status=new subject='${RTSUBJ} ${HOSTNAME}'
queue='${RTQUEUE}' priority='5' text='${RTMSG}'

Of course, the single quotes caused an issue, and I moved to double
quotes. but then rt was still complaining:

rt: edit: Unrecognised argument 'text=blah
blah'.

Yes, this is multi-line text... and I figured this was causing the
issue, since removing the "text" parameter allowed a ticket to be
created. I figured a template-based ticket creation would work. When I
noticed the -o option, and went to work with this idea:


rt create -t ticket -o set status=new subject="${RTSUBJ} (${HOSTNAME})"
queue="${RTQUEUE}" priority=5 | sed -e '$d' > ${RTTMP}
echo "Text: ${RTMSG}" >> ${RTTMP}
cat ${RTTMP} | rt create -t ticket -i


This creates the template, hacks out the "Text: " line, then adds it
again with the appropriate data. However, I get this:


# Please resubmit with errors corrected.

--

# Syntax error.

id: ticket/new
Queue: General
Requestor: sbsupdate
Subject: test ticket
Cc:
AdminCc:
Owner:
Status: new
Priority: 5
InitialPriority:
FinalPriority:
TimeEstimated:
Starts: 2008-03-06 05:31:56
Due: 2008-03-06 05:31:56
Text: blah
>> blah



Not even THIS way likes the multiple lines of text. I suppose I could
really hack it by creating an email header and passing all of this to
rt-mailgate, but that REALLY seems like a hack.

Ideas welcome...

Thank you!

Steve

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20080306/98e4253a/attachment.sig>


More information about the rt-users mailing list