[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: recommendations for data population



Hrm, well, it sounds like my best action is to simply make my script as robust as possible. That's definitely doable. I just like to be extra cautious with these things sometimes. ;) Guess I can't bet on -anything- being assured to show up. (silly me to think everyone would have a first name in our data feed ;D) Anyway, I was just curious if there was a real quick "make sure this fits the schema". Looks like no. =) (at some level, what I was wanting is 'exactly' what the ldap server itself does, when it gets to a bad record and stops and yells at me)

Daniel

got data without a first name is beyond me)  Anyway, here's my delima.  I
am planning on running a script to perform updates regularly (probably
once a day for now) which generates the ldif files, sorts them, does a
diff with the last sorted ldif file, and uploads the changes via
ldapmodify.  However, since I consider gn a required field, and it wasn't
present, the ldapmodify croaked about 1/8th of the way into the upload.

Sounds like you need a more robust script.

I'm working something similar, and have posted some of my hacks at
https://webserver.brandeis.edu/pages/view/Network/LdapConversion

Normally I would go "ok well, I'll fix and rerun".  But a good chunk of
the data has already been uploaded at this point.  So...  does anyone know
of any good ways to test an ldif file, or even just an ldif entry, to
verify that it is valid?  Are there perl modules that absorb the schema
files and can test your entry for validity?  I'd much rather croak out

The below will work with openldap 2.0 and up. You might also need to test for syntax; for example, the directory server will reject telephone numbers that don't look like telephone numbers.

#!/usr/bin/perl
use Net::LDAP;
$ldap = Net::LDAP->new('localhost');
$ldap->bind();
$schema = $ldap->schema();
print "MUST:\n";
foreach $attr ($schema->must("inetOrgPerson")) {
 print $attr->{name} . "\n";
}
print "\nMAY:\n";
foreach $attr ($schema->may("inetOrgPerson")) {
 print $attr->{name} . "\n";
}



-- /\\\----------------------------------------------------------------------///\ \ \\\ Daniel Henninger http://www.vorpalcloud.org/ /// / \_\\\ North Carolina State University - Systems Programmer ///_/ \\\ Information Technology <IT> /// """--------------------------------------------------------------"""