Commit 4702149c authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Fixes #5178 Improved --migrate-systems option for fusiondirectory-setup

parent 3c4a209e
......@@ -1788,14 +1788,12 @@ sub migrate_systems {
if (ask_yn_question("Migrate these entries to $newOC objectClass?")) {
foreach my $entry (@entries) {
my $newrdn = "cn=".$entry->get_value('cn')."+ipHostNumber=".$entry->get_value('ipHostNumber');
$mesg = $ldap->moddn($entry->dn(), newrdn => $newrdn);
if ($mesg->code) {
print $entry->dn().": ".$mesg->error."\n";
next;
}
my $tmprdn = "cn=".$entry->get_value('cn')."+ipHostNumber=".$entry->get_value('ipHostNumber');
my $newrdn = "cn=".$entry->get_value('cn');
my $dn_old = $entry->dn();
$dn_old =~ s/^[^,]+,/$newrdn,/;
my $dn_new = $entry->dn();
$dn_new =~ s/^[^,]+,/$tmprdn,/;
$entry->dn($dn_new);
my @replace = ('ieee802Device', 'ipHost', $newOC);
my @classes = $entry->get_value('objectClass');
foreach my $class (@classes) {
......@@ -1811,7 +1809,15 @@ sub migrate_systems {
}
undef @replace;
$mesg = $ldap->delete($dn_old);
$mesg->code && print $dn_old.": ".$mesg->error."\n";
if ($mesg->code) {
print $entry->dn().": ".$mesg->error."\n";
next;
}
$mesg = $ldap->moddn($dn_new, newrdn => $newrdn);
if ($mesg->code) {
print $entry->dn().": ".$mesg->error."\n";
next;
}
}
}
} else {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment