[rt-users] user batch add script failing

Andy Harrison aharrison at gmail.com
Fri Jun 29 14:11:33 EDT 2012


On Thu, Jun 28, 2012 at 12:40 PM, Kevin Falcone
<falcone at bestpractical.com> wrote:
> On Wed, Jun 27, 2012 at 11:09:27PM -0400, Andy Harrison wrote:
>
> The fact that you see errors like this:
>
>> [Wed Jun 27 22:43:04 2012] [info]:
>> RT::Authen::ExternalAuth::CanonicalizeUserInfo returning Address1: 21
>> JARVIS AVE, City: ROCHESTER, Comments: Autocreate from metrocast
>> customer mysql db, Disabled: , EmailAddress: devnull.16 at metrocast.net,
>> Gecos: 327830, HomePhone: 6039999999, Name: 8282828282100011,
>> Password: placeholderpassword.16, Privileged: , RealName: METROCAST
>> TEST ACCT HBO ONLY NoHSI, State: NH, WorkPhone: 0000000000, Zip: 03868
>> (/opt/rt4/local/plugins/RT-Authen-ExternalAuth/lib/RT/Authen/ExternalAuth.pm:651)
>> Trace begun at /opt/rt6/lib/RT.pm line 250
>
> Means that your code below to clobber Plugins isn't working, in large
> part because the Plugins have already been loaded during LoadConfig
> and Init.
>
>> use RT::Config;
>>
>> RT::LoadConfig();
>>
>> RT::Init();
>>
>> # Make sure external auth is disabled and autocreate is enabled.
>> #
>> RT->Config->Set( ExternalInfoPriority       => [ ] );
>> RT->Config->Set( Plugins                    => ['RT::OnlineDocs'] );
>> RT->Config->Set( AutoCreate                 => { Privileged => 0 } );
>> RT->Config->Set( AutoCreateNonExternalUsers => 1 );
>
> You may find it easier to cheat and run your script with
> RT_SITE_CONFIG=/my/smaller/rt_site_config.pm myscrips.pl
> and rt_site_config.pm doesn't declare any of your ExternalAuth
> plugins.
>
> Also, pelase note that AutoCreate only comes into play for users
> created in the WebUI, so is irrelevant here.  Also,
> AutoCreateNonExternalUsers is an RT-Authen-ExternalAuth config option
> and is irrelevant if you're disabling RT-Authen-ExternalAuth.
>
> If you don't want a second site config, you'll need to ensure that
> your config changes happen before RT loads and parses plugins.
>
> -kevin





Oops...  I must have corked something when I was cleaning the script
up to post here, I had that taken care of previously.  I was just
looking to make sure the LDAP related items weren't showing up, didn't
look for that telltale CanonicalizeUserInfo log entry.

Regardless, your suggestion to use the RT_SITE_CONFIG variable is
easier so I did that.  It pared down the log output but the it's still
the same problem.


[Thu Jun 28 18:20:35 2012] [error]: Could not create a new user -
Comments-Autocreate from metrocast customer mysql
db-RealName-METROCAST TEST ACCT HBO ONLY
NoHSI-City-ROCHESTER-State-NH-EmailAddress-devnull.16 at metrocast.net-Gecos-327830-Password-!sha512!8LUzx22g0JywKrDy!lz/mt/QovpBky0DSbAjiAg6veGNwsu4ZT2YtR6kwWxa8v3VISHtLOb7wPB271zGL87VgKZIW9LCxgR0bn+ylZA-HomePhone-6039999999-Address1-21
JARVIS AVE-Zip-03868-WorkPhone-0000000000-Name-8282828282100011
(/opt/rt4/lib/RT/User.pm:280)
Trace begun at /opt/rt4/lib/RT.pm line 250

Log::Dispatch::__ANON__('Log::Dispatch=HASH(0x3b1dda0)', 'Could not
create a new user - Comments-Autocreate from metrocast customer mysql
db-RealName-METROCAST TEST ACCT HBO ONLY
NoHSI-City-ROCHESTER-State-NH-EmailAddress-devnull.16 at metrocast.net-Gecos-327830-Password-!sha512!8LUzx22g0JywKrDy!lz/mt/QovpBky0DSbAjiAg6veGNwsu4ZT2YtR6kwWxa8v3VISHtLOb7wPB271zGL87VgKZIW9LCxgR0bn+ylZA-HomePhone-6039999999-Address1-21
JARVIS AVE-Zip-03868-WorkPhone-0000000000-Name-8282828282100011')
called at /opt/rt4/lib/RT/User.pm line 280

RT::User::Create(undef, 'Comments', 'Autocreate from metrocast
customer mysql db', 'Privileged', 0, 'City', 'ROCHESTER', 'RealName',
'METROCAST TEST ACCT HBO ONLY NoHSI', 'State', 'NH', 'EmailAddress',
'devnull.16 at metrocast.net', 'Gecos', 327830, 'HomePhone', 6039999999,
'Password', 'placeholderpassword.16', 'Address1', '21 JARVIS AVE',
'Disabled', 0, 'WorkPhone', 0000000000, 'Zip', 03868, 'Name',
8282828282100011) called at rt_create_user_test.pl line 166



So I started chasing down the $self->SUPER::Create from RT::User and
moved onto RT::Record and put some debugging output in there.  Inside
RT::Record::Create, the $self->SUPER::Create call gets an expected
value back for $id.  If I run a Dumper() directly on the
$self->Load($id), it comes back with ( 1, 'Found Object' ) and I
verified that none of the errno cases were matched, though that's
obvious since $id is a plain scalar with an integer.

Since ref $self shows an RT::Principal object at this stage, I tried a
few of those methods.  $self->id shows the expected integer.
$self->IsUser is 1.  $self->IsGroup is undefined.
$self->PrincipalType is 'User'.  $self->Disabled is 0.
$self->ObjectId is also 0.

So, after the Load, I made a new user obj:

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

But then doing a Dumper( $curUserObj->Load($self->id) ) comes back
with ( 0, "Couldn't find row" ).

Not sure how to dig deeper at this point.  Any suggestions?


--
Andy Harrison
public key: 0x67518262



More information about the rt-users mailing list