admserv/newinst/src/30updateglobalpref.pl.in | 2 -
admserv/newinst/src/AdminMigration.pm.in | 5 ++--
admserv/newinst/src/AdminUtil.pm.in | 29 +++++++++++++++++++++++----
3 files changed, 29 insertions(+), 7 deletions(-)
New commits:
commit 26efc6d06796e1493763eab3e67e02034a44c432
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Fri Jul 1 09:17:15 2011 -0600
Bug 718079 - Perl errors when running migrate-ds-admin.pl
https://bugzilla.redhat.com/show_bug.cgi?id=718079
Resolves: bug 718079
Bug Description: Perl errors when running migrate-ds-admin.pl
Reviewed by: nkinder, nhosoi (Thanks!)
Branch: master
Fix Description: We may not have a single $admininf object if there is a
skin package, so get the first value from the list of Inf objects. Added
a new function getInfsVal to get the value from a list of Inf objects
given a section and a parameter.
30updateglobalprefs was using the wrong map - we don't need the configds
map if we're just doing updates.
during migration ConfigDirectoryAdminID can be just a userid - do not
assume it will always be a DN
Had to amend my previous patch - ConfigDirectoryAdminID was not being set
Platforms tested: Fedora 15 x86_64
Flag Day: no
Doc impact: no
diff --git a/admserv/newinst/src/30updateglobalpref.pl.in
b/admserv/newinst/src/30updateglobalpref.pl.in
index 14dc910..eb48517 100644
--- a/admserv/newinst/src/30updateglobalpref.pl.in
+++ b/admserv/newinst/src/30updateglobalpref.pl.in
@@ -38,7 +38,7 @@ sub post {
$setupinf->{General}->{Suffix} = 'notused';
my $upd = { path => '@ldifdir(a)/02globalpreferences.ldif.tmpl',
- mapper => "@infdir(a)/configdsroot.map",
+ mapper => "@infdir(a)/updateconsoleinfo.map",
infary => \@infs
};
diff --git a/admserv/newinst/src/AdminMigration.pm.in
b/admserv/newinst/src/AdminMigration.pm.in
index 4ee9ab4..78c8328 100644
--- a/admserv/newinst/src/AdminMigration.pm.in
+++ b/admserv/newinst/src/AdminMigration.pm.in
@@ -295,9 +295,10 @@ sub updateConsoleInfo {
for (@oldents) {
my $olddn = $_->getDN();
- if (($olddn =~ /ou=(\d.\d)/) && ($1 ne
$admininf->{admin}->{ConsoleVersion})) {
+ my $ver = getInfsVal('admin', 'ConsoleVersion', @infs);
+ if (($olddn =~ /ou=(\d.\d)/) && ($1 ne $ver)) {
my $newdn = $olddn;
- $newdn =~ s/ou=$1/ou=$admininf->{admin}->{ConsoleVersion}/;
+ $newdn =~ s/ou=$1/ou=$ver/;
my $newent = $_;
$newent->setDN($newdn);
$conn->add($newent);
diff --git a/admserv/newinst/src/AdminUtil.pm.in b/admserv/newinst/src/AdminUtil.pm.in
index 496e1ed..b33b601 100644
--- a/admserv/newinst/src/AdminUtil.pm.in
+++ b/admserv/newinst/src/AdminUtil.pm.in
@@ -23,13 +23,13 @@ require Exporter;
updateAdmConf updateAdmpw updateLocalConf importCACert
getLocalConfigDS getPset registerDSWithConfigDS
registerManyDSWithConfigDS createSubDSNoConn
- registerScatteredDSWithConfigDS getInfs
+ registerScatteredDSWithConfigDS getInfs getInfsVal
unregisterDSWithConfigDS isConfigDS addConfigACIsToSubDS);
@EXPORT_OK = qw(getAdmConf getConfigDSConn createConfigDS createSubDS
updateAdmConf updateAdmpw updateLocalConf importCACert
getLocalConfigDS getPset registerDSWithConfigDS
registerManyDSWithConfigDS createSubDSNoConn
- registerScatteredDSWithConfigDS getInfs
+ registerScatteredDSWithConfigDS getInfs getInfsVal
unregisterDSWithConfigDS isConfigDS addConfigACIsToSubDS);
# load perldap
@@ -705,6 +705,8 @@ sub registerManyDSWithConfigDS {
}
$instinf->{General}->{ConfigDirectoryLdapURL} =
$inf->{General}->{ConfigDirectoryLdapURL};
+ $instinf->{General}->{ConfigDirectoryAdminID} =
+ $inf->{General}->{ConfigDirectoryAdminID};
$instinf->{General}->{AdminDomain} = $inf->{General}->{AdminDomain};
$instinf->{admin}->{ServerAdminID} = $inf->{admin}->{ServerAdminID};
if (!registerDSWithConfigDS($inst, $errs, $instinf,
@@ -834,7 +836,11 @@ sub registerDSWithConfigDSExt {
# need to get the admin uid
if (!$inf->{admin}->{ServerAdminID}) {
my @rdns = ldap_explode_dn($inf->{General}->{ConfigDirectoryAdminID}, 1);
- $inf->{admin}->{ServerAdminID} = $rdns[0];
+ if (@rdns and $rdns[0]) {
+ $inf->{admin}->{ServerAdminID} = $rdns[0];
+ } else { # a userid not a dn
+ $inf->{admin}->{ServerAdminID} =
$inf->{General}->{ConfigDirectoryAdminID};
+ }
}
my $instinf;
@@ -896,7 +902,7 @@ sub getInfs {
for my $inffile (@infs) {
if ($inffile =~ m,^@infdir(a)/.+-$name\.inf$,) {
# brand specific
- debug(2, "Found brand specific inf file", $inffile);
+ debug(2, "Found brand specific inf file", $inffile,
"\n");
push @ary, new Inf($inffile);
}
}
@@ -909,6 +915,21 @@ sub getInfs {
return @ary;
}
+# get a value from a collection of Inf objects
+# given a section and a parameter, will return
+# the value from the first Inf that has the
+# section and value
+sub getInfsVal {
+ my ($sec, $parm, @infs) = @_;
+ for my $inf (@infs) {
+ if ($inf and exists($inf->{$sec}) and defined($inf->{$sec}) and
+ exists($inf->{$sec}->{$parm}) and defined($inf->{$sec}->{$parm}))
{
+ return $inf->{$sec}->{$parm};
+ }
+ }
+ return undef;
+}
+
1;
# emacs settings