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

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

Community help: http://wiki.bestpractical.com
Commercial support: [EMAIL PROTECTED]


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at http://rtbook.bestpractical.com

Reply via email to