<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hello!<br>
   I received no replies.. perhaps I posted too much info?<br>
<br>
   So far I've tried this a few different ways, and have had no luck
with creating tickets from the command line with multiple lines of text.<br>
<br>
This breaks:<br>
# rt create -e -t ticket set subject='testing' text='blah<br>
blah<br>
blah'<br>
<br>
However, I can do this:<br>
# rt create -e -t ticket set subject='testing'<br>
<br>
then I can comment on it:<br>
# rt comment -m 'This is a multi-<br>
line test of text' 600<br>
<br>
...which allows me to use data with multiple lines. Since the original
ticket creation email didn't have the text with it, I didn't like this
approach and I decided to hack the rt tool. I'm using rt that installs
with Ubuntu 7.10's rt3.6-clients package. At line 423, I added the
following:<br>
<br>
            elsif (/-m/) {<br>
                vpush( \%set, lc 'text', shift @ARGV);<br>
            }<br>
<br>
I'm sorry, I don't know the correct way to submit a patch with the +'s
an @whatevers, but this is what I did, and now the following works fine:<br>
<br>
rt create -e -t ticket set subject='testing' -m 'blah multi-<br>
line text'<br>
<br>
I hope this change (or similar) can make it into the next release.<br>
<br>
Also, I just noticed that I cannot place text into custom fields when
using the command line interface. Perhaps I'll just have to write my
own. :)<br>
<br>
Regards,<br>
Steve<br>
<br>
<br>
Steve Switzer wrote:
<blockquote cite="mid47CF853C.60609@switzersolutions.com" type="cite">
  <pre wrap="">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
  </pre>
  <blockquote type="cite">
    <blockquote type="cite">
      <pre wrap="">blah
      </pre>
    </blockquote>
  </blockquote>
  <pre wrap=""><!---->


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

  </pre>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
<a class="moz-txt-link-freetext" href="http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users">http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users</a>

Community help: <a class="moz-txt-link-freetext" href="http://wiki.bestpractical.com">http://wiki.bestpractical.com</a>
Commercial support: <a class="moz-txt-link-abbreviated" href="mailto:sales@bestpractical.com">sales@bestpractical.com</a>


Discover RT's hidden secrets with RT Essentials from O'Reilly Media. 
Buy a copy at <a class="moz-txt-link-freetext" href="http://rtbook.bestpractical.com">http://rtbook.bestpractical.com</a></pre>
</blockquote>
</body>
</html>