[Fedora-directory-commits] ldapserver/ldap/admin/src/scripts DSMigration.pm.in, 1.18, 1.19 migrate-ds.res, 1.6, 1.7

Richard Allen Megginson (rmeggins) fedora-directory-commits at redhat.com
Wed Oct 17 15:56:56 UTC 2007


Author: rmeggins

Update of /cvs/dirsec/ldapserver/ldap/admin/src/scripts
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv20110/ldapserver/ldap/admin/src/scripts

Modified Files:
	DSMigration.pm.in migrate-ds.res 
Log Message:
Resolves: bug 333291
Bug Description: Do not allow direct migration if the source db index has old IDL format
Reviewed by: nkinder (Thanks!)
Fix Description: Just before the attempt to copy the database directories, look at the DBVERSION file from the source.  If it is determined that the source version is too old, just exit migration and output a helpful error message.
Platforms tested: RHEL4 i386
Flag Day: no
Doc impact: no
QA impact: should be covered by regular nightly and manual testing
New Tests integrated into TET: none



Index: DSMigration.pm.in
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/scripts/DSMigration.pm.in,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- DSMigration.pm.in	5 Oct 2007 02:30:07 -0000	1.18
+++ DSMigration.pm.in	17 Oct 2007 15:56:53 -0000	1.19
@@ -241,10 +241,37 @@
  'nsslapd-idl-switch' => \&migIdlSwitch
 );
 
+sub getDBVERSION {
+    my $olddbdir = shift;
+    my $data = shift;
+
+    open DBVERSION, "$olddbdir/DBVERSION" or 
+        return ('error_reading_dbversion', $olddbdir, $!);
+    my $line = <DBVERSION>;
+    close DBVERSION;
+    chomp($line);
+    my @foo = split("/", $line);
+    $data = \@foo;
+    return ();
+}
+
 sub copyDatabaseDirs {
     my $srcdir = shift;
     my $destdir = shift;
     my $filesonly = shift;
+    my @errs;
+
+    # check old DBVERSION file
+    my @verinfo;
+    if (@errs = getDBVERSION($srcdir, \@verinfo)) {
+        return @errs;
+    }
+
+    if ((($verinfo[0] =~ /^netscape/i) or ($verinfo[0] =~ /^iplanet/i)) and
+        (($verinfo[1] =~ /^6/) or ($verinfo[1] =~ /^5/) or ($verinfo[1] =~ /^4/))) {
+        return ('error_database_too_old', $srcdir, @verinfo);
+    }
+
     if (-d $srcdir && ! -d $destdir && !$filesonly) {
         debug(1, "Copying database directory $srcdir to $destdir\n");
         if (system ("cp -p -r $srcdir $destdir")) {


Index: migrate-ds.res
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/scripts/migrate-ds.res,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- migrate-ds.res	5 Oct 2007 02:30:07 -0000	1.6
+++ migrate-ds.res	17 Oct 2007 15:56:53 -0000	1.7
@@ -25,3 +25,9 @@
 fixing_integer_attr_index = The index for the attribute '%s' in the database directory '%s' will be removed and re-created.\n\n
 error_removing_index_file = Could not remove the index file '%s'.  Error: %s\n\n
 error_recreating_index_file = Could not re-create the index file '%s'.  Error: %s\n\n
+error_reading_dbversion = Could not read the old database version information from '%s'.  Error: %s\n\n
+error_database_too_old = The database at '%s' is version '%s/%s'.\
+This version cannot be migrated using the database binaries.  You must\
+first convert the databases to LDIF format and use the cross platform\
+migration procedure.  This procedure is documented in the migration\
+guide and in the help for this script.\n\n




More information about the Fedora-directory-commits mailing list