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

Re: recommendations for data population



On Wed, 14 Jul 2004, Daniel Henninger wrote:

> 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";
}