External Script to sync User info with LDAP fails


I run an external perl script as a weekly cronjob to synchronize LDAP
updates with our Users in RT. It uses the RT libraries so that I can
get access to RT variables and methods and log. Everything works fine
until I try to update the record, at that point it fails.

I don’t think it’s a permissions user and I create my user object like
this with the system user…

my $UserObj = RT::User->new($RT::SystemUser);

Upon advice from Mike Peachey, I added the following to my update
statement so I could retrieve some error messages…

my ($method_success, $method_msg) = $UserObj->Update(
AttributesRef => @fields,
ARGSRef => %ARGS);

That didn’t seem to make any difference and no messages were returned.

I then added an “or die” to the end of that line like this…

my ($method_success, $method_msg) = $UserObj->Update(
AttributesRef => @fields,
ARGSRef => %ARGS) or die “Cant update record\n”;

This actually produced some error messages at least…

From my log…
[Fri Feb 22 12:56:37 2008] [warning]: Attempted to rollback a
transaction with none in progress at
/usr/lib/perl5/site_perl/5.8.8/DBIx/SearchBuilder/Handle.pm line 747

, ‘Action’, ‘rollback’, ‘Force’, ‘undef’) called at
/usr/lib/perl5/site_perl/5.8.8/DBIx/SearchBuilder/Handle.pm line 788

called at /opt/rt3/lib/RT.pm line 360
RT::ANON(‘Cant update record\x{a}’) called at
local/RT-LDAP-Cron-Cleanup.pl line 147
RT::CHECK_LDAP_RECORD(41) called at
local/RT-LDAP-Cron-Cleanup.pl line 100
[Fri Feb 22 12:56:37 2008] [crit]: Cant update record

I’m not sure how to verify this but it seems like my script doesn’t have
access to that Update method. Perhaps, I’m not loading the libraries

package USER_LOCAL;
use lib ‘/opt/rt3/local/lib/RT’;
use User_Local;

package RT;
use lib ‘/opt/rt3/lib’;
use RT;

BTW, I started this new thread because I didn’t want to hijack Mr.
Robert’s since I no longer think we are having a similar problem.

I did attach my script…

Thanks for any help,

Craig Patterson
Application Developer/SDE Administrator
Northrop Grumman IT/City of Grand Rapids

RT-LDAP-Cron-Cleanup.pl (5.12 KB)