[Fedora-directory-commits] ldapserver/ldap/admin/src/scripts DSMigration.pm.in, 1.7, 1.8 migrate-ds.res, 1.4, 1.5

Richard Allen Megginson (rmeggins) fedora-directory-commits at redhat.com
Thu Aug 30 00:06:53 UTC 2007


Author: rmeggins

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

Modified Files:
	DSMigration.pm.in migrate-ds.res 
Log Message:
Resolves: bug 260341
Bug Description: Migration script references a non-existing directory
Reviewed by: nhosoi (Thanks!)
Fix Description: This fixes a couple of problems.
1) Use the inst_dir from the directory server as the instance dir where the ldif2db script is found.
2) The password for migratecred should be quoted before being passed to the shell, in case there are shell meta chars in there
3) If using cross platform migration, and no LDIF files were found to migrate, this will cause an error message to be printed and migration will be aborted.
Platforms tested: RHEL4 i386, RHEL5 x86_64
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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- DSMigration.pm.in	29 Aug 2007 23:10:22 -0000	1.7
+++ DSMigration.pm.in	30 Aug 2007 00:06:51 -0000	1.8
@@ -152,8 +152,8 @@
 sub migrateCredentials {
     my ($ent, $attr, $mig, $inst) = @_;
     my $oldval = $ent->getValues($attr);
-    debug(3, "Executing @bindir@/migratecred -o $mig->{actualsroot}/$inst -n @instconfigdir@/$inst -c $oldval . . .\n");
-    my $newval = `@bindir@/migratecred -o $mig->{actualsroot}/$inst -n @instconfigdir@/$inst -c $oldval`;
+    debug(3, "Executing @bindir@/migratecred -o $mig->{actualsroot}/$inst -n @instconfigdir@/$inst -c \'$oldval\' . . .\n");
+    my $newval = `@bindir@/migratecred -o $mig->{actualsroot}/$inst -n @instconfigdir@/$inst -c \'$oldval\'`;
     debug(3, "Converted old value [$oldval] to new value [$newval] for attr $attr in entry ", $ent->getDN(), "\n");
     return $newval;
 }
@@ -235,18 +235,15 @@
     my $olddefault = "$mig->{actualsroot}/$inst/db"; # old default db home directory
     my @errs;
 
+    # the ldif2db command will be in nsslapd-instancedir
+    my $cfgent = $dest->search("cn=config", "base", "(objectclass=*)");
+    my $inst_dir = $cfgent->getValues('nsslapd-instancedir');
     # first, look for an LDIF file in that directory with the same name as the
     # database
     my $foundldif;
     for (glob("$mig->{oldsroot}/$inst/db/*.ldif")) {
         my $dbname = basename($_, '.ldif');
-        my $cmd = "";
-        if ("@with_fhs_opt@") {
-            $cmd = "/opt/@PACKAGE_NAME@/$inst/ldif2db -n \"$dbname\" -i \"$_\"";
-        } else {
-            $cmd = "@serverdir@/$inst/ldif2db -n \"$dbname\" -i \"$_\"";
-        }
-
+        my $cmd = "$inst_dir/ldif2db -n \"$dbname\" -i \"$_\"";
         debug(1, "migrateDatabases: executing command $cmd\n");
         $? = 0; # clear error condition
         my $output = `$cmd 2>&1`;
@@ -259,6 +256,8 @@
 
     if ($foundldif) {
         return (); # done - can do nothing else for cross-platform
+    } elsif ($mig->{crossplatform}) { # cross platform requires LDIF files
+        return ('ldif_required_for_cross_platform', "$mig->{oldsroot}/$inst/db");
     }
 
     # if no LDIF files, just copy over the database directories


Index: migrate-ds.res
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/admin/src/scripts/migrate-ds.res,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- migrate-ds.res	15 Aug 2007 02:51:50 -0000	1.4
+++ migrate-ds.res	30 Aug 2007 00:06:51 -0000	1.5
@@ -17,3 +17,8 @@
 error_copying_secmoddb = Could not copy the security module database file '%s' to '%s'.  Error: %s\n
 error_copying_pinfile = Could not copy the key database PIN file '%s' to '%s'.  Error: %s\n
 error_copying_certmap = Could not copy the client certificate mapping file '%s' to '%s'.  Error: %s\n
+ldif_required_for_cross_platform = No LDIF files were found in %s.\n
+LDIF files are required in order to do cross platform migration.  The\
+database files are not binary compatible, and the new databases must\
+be initialized from an LDIF export of the old databases.  Please refer\
+to the migration instructions for help with how to do this.\n\n




More information about the Fedora-directory-commits mailing list