[rt-users] CLI - Line Breaks for body
Frank Pater
fpater at dca.net
Thu Sep 14 16:45:30 EDT 2006
Hi,
On Thu, Sep 14, 2006 at 01:26:52PM -0700, Chris Black wrote:
> Hi, I haven't attempted to use this CLI command before, but when I
> try now I get:
>
> [root at felwood rt]$ ./bin/rt comment -m "this is a test\n test" 5242
> Password:
> rt: Server error: Not Found (404)
>
> Any ideas on that?
Near the top of ./bin/rt there is a hash, %config. Try setting 'server' in this hash to the URL of your RT WebUI (it defaults to http://localhost/rt/ so if you can't access the WebUI via lynx from the server command-line, then this is probably why the CLI tool is failing). As for the code below, I'm still working through something similar, and I'm afraid I can't help much with that. At a minimum, you should be able to execute
./bin/rt create -t ticket
and successfully create a ticket. After that, the comment syntax should work as well.
Sincerely,
Frank Pater
DCANet
http://www.dca.net
voice: 888-4-DCANET (888-432-2638)
fax: 302-426-6386
>
> I currently do it using this script:
> #!/usr/bin/perl -w
>
> use lib "/usr/local/rt/lib";
> use lib "/usr/local/rt/etc";
>
> use RT::Interface::CLI;
> use RT;
> RT::LoadConfig();
> RT::Init();
> use RT::Ticket;
> use RT::CurrentUser;
> my $CurrentUser = RT::Interface::CLI::GetCurrentUser();
>
> use MIME::Entity;
>
> $queue = $ARGV[0];
> $requestor = $ARGV[1];
> $subject = $ARGV[2];
> $body = $ARGV[3];
> $client = $ARGV[4];
> $contact = $ARGV[5];
> $impact = $ARGV[6];
> $phi = $ARGV[7];
> $source = $ARGV[8];
> $category = $ARGV[9];
> $severity = $ARGV[10];
> my $ticket = new RT::Ticket($CurrentUser);
> my $ticket_body = MIME::Entity->build(Data => $body,
> Type => 'text/plain');
>
> my %ticket_vals = ( Queue => $queue,
> Subject => $subject,
> Owner => '',
> Requestor => $requestor,
> InitialPriority => '11',
> FinalPriority => '20',
> MIMEObj => $ticket_body,
> 'CustomField-2' => $client,
> 'CustomField-14' => $contact,
> 'CustomField-21' => $impact,
> 'CustomField-10' => $phi,
> 'CustomField-26' => $source,
> 'CustomField-20' => $category,
> 'CustomField-15' => $severity,
> );
> my ($id, $transaction_object, $err) = $ticket->Create(%
> ticket_vals);
> print STDERR $err . "\n" if $err;
>
>
> Thanks,
> Cj B
>
>
> On Sep 14, 2006, at 1:12 PM, Frank Pater wrote:
>
> >Hi Cj,
> >
> >We were unable to get the text attribute of 'rt create -t ticket'
> >to accept newlines on the CLI. The -m flag to 'rt comment' accepts
> >them, though. We used this 2-step process to create our tickets
> >with existing data.
> >
> >Sincerely,
> >Frank Pater
> >DCANet
> >http://www.dca.net
> >voice: 888-4-DCANET (888-432-2638)
> >fax: 302-426-6386
> >
> >On Thu, Sep 14, 2006 at 12:50:49PM -0700, Chris Black wrote:
> >>Hi, I need to use the CLI to create tickets, however I'm having
> >>issues submitting line breaks in the body. How do you indicate a line
> >>break to RT through the CLI. I'm using the script in this example:
> >>http://wiki.bestpractical.com/index.cgi?CliBasics
> >>
> >>Thanks,
> >>Cj B
> >>_______________________________________________
> >>http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> >>
> >>Community help: http://wiki.bestpractical.com
> >>Commercial support: sales at bestpractical.com
> >>
> >>
> >>Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> >>Buy a copy at http://rtbook.bestpractical.com
>
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20060914/689fbb3e/attachment.sig>
More information about the rt-users
mailing list