[rt-users] make RT aware of ScripCondition modules - alternate methods?

Mike Patterson mikep at uclink.berkeley.edu
Wed Jan 25 19:54:31 EST 2006


I created a custom scrip Action module 
(/my-rt-directory/local/lib/RT/Action/AddDept.pm) that I would like to 
make RT aware of so that I can call it from scrips.

Using the example from "RT Essentials" at the bottom of page 79, I 
created an executable and ran it to "register" a module. This worked 
great on my test box (RT 3.4.4 basic setup), but failed on my production 
box (RT 3.3.2 that relies on apache ldap authentication).

I think my problems lies in that I can't get "bin/rt", the CLI to work 
on my production box which uses Apache/LDAP authentication.

Are there any other ways to register the module other than rely on the CLI?

Error I get:
----------------
[Thu Jan 26 00:56:36 2006] [crit]: Can't locate object method "new" via 
package "RT::ScripAction" (perhaps you forgot to load 
"RT::ScripAction"?) at ./register_module.pl line 21.
(/usr/local/rt3/lib/RT.pm:276)

Details of my "register.pl" executable:
----------------
#!/usr/bin/perl

   use strict;
   use lib "/usr/local/rt3/lib";

   use RT;
   use RT::Interface::CLI qw( CleanEnv GetCurrentUser );
   use RT::ScripCondition;

   CleanEnv(  );
   RT::LoadConfig(  );
   RT::Init(  );

   my $user = GetCurrentUser(  );
   unless( $user->Id ) {
       print "No RT user found. Please consult your RT administrator.\n";
       exit 1;
   }
   #hack
#    $user = "root";
   my $sc = RT::ScripAction->new($user);

   $sc->Create( Name        => 'Add Department',
                Description => 'set department custom field for new 
tickets',
                ExecModule  => 'AddDepartment',
              );

-- 
Mike Patterson
Systems Manager
UC Berkeley Extension




More information about the rt-users mailing list