[rt-users] Problem with the rt perl module and authentication

Rappaport, Evan evan at mtvn.com
Tue Dec 20 16:20:37 EST 2005


I'm trying to run a script which uses the RT::Interface::CLI and I get
the following error from the command line. Anyone get this error?
Below is the code using the perl interface and below that is and example
call from the command line.  I believe that the problem is probably with
GetCurrentUser() but I am not sure.

Thanks

The error is ....

Couldn't load  from the users database.
 (/opt/rt3/lib/RT/CurrentUser.pm:145)

------------------------------------------------------------------------
--------------------------------------------

Here is a test script ....


#!/usr/bin/perl -w

use lib ("/opt/rt3/local/lib","/opt/rt3/lib");
use RT::Interface::CLI;
use RT;
use RT::Ticket;
use RT::CurrentUser;
use Getopt::Long;

$queue = '';
$body = '';

GetOptions ("queue=s" => \$queue,
            "subject=s" => \$subject,
            "owner=s" => \$owner,
            "requestor=s" => \$requestor,
            "priority=s" => \$priority,
            "body=s" => \$body,
            "AdminCc=s" => \$AdminCc,
            "cc=s" => \$cc,
            "RefersTo=s" => \$RefersTo,
            "ReferredToBy=s" => \$ReferredToBy,
            "DependsOn=s" => \$DependsOn,
            "Parents=s" => \$Parents
);

# setting some defaults
if ($queue eq '')
{
        print_usage();
        exit (0);
}

if ($body eq '')
{
        $body=' ';
}
RT::LoadConfig();
RT::Init();

if ($owner eq '') {$owner = 'Nobody';}

my $CurrentUser = RT::Interface::CLI::GetCurrentUser();

use MIME::Entity;

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 => $owner,
                   Requestor => $requestor,
                   InitialPriority => $priority,
                   MIMEObj => $ticket_body,
                   AdminCc => $AdminCc,
                   Cc => $cc,
                   'RefersTo' => $RefersTo,
                   'ReferredToBy' => $ReferredToBy,
                   'DependsOn' => $DependsOn,
                   'MemberOf' => $Parents
                 );

my ($id, $transaction_object, $err) = $ticket->Create(%ticket_vals);
print $err . "\n" if $err;

------------------------------------------------------------------------
--------------------------------------------

This is a test call of the script.

./test.pl -queue="Development" -subject="This is a test subject for test
script" -owner='bob' -requestor='bob at bob.com' -priority=99 -body="This
is the body of the ticket"



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20051220/105da0e1/attachment.htm>


More information about the rt-users mailing list