Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 159487 Details for
Bug 247215
Reimplement ds_remove (cgi) and ds_removal (command line wrapper) without setuputil code
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
cvs diff (adminserver)
as.diffs (text/plain), 10.74 KB, created by
Noriko Hosoi
on 2007-07-18 01:33:03 UTC
(
hide
)
Description:
cvs diff (adminserver)
Filename:
MIME Type:
Creator:
Noriko Hosoi
Created:
2007-07-18 01:33:03 UTC
Size:
10.74 KB
patch
obsolete
>Index: Makefile.am >=================================================================== >RCS file: /cvs/dirsec/adminserver/Makefile.am,v >retrieving revision 1.23 >diff -t -w -U4 -r1.23 Makefile.am >--- Makefile.am 11 Jul 2007 01:20:21 -0000 1.23 >+++ Makefile.am 18 Jul 2007 01:22:16 -0000 >@@ -162,9 +162,9 @@ > ds_db2bak ds_listdb ds_rmdb ds_snmpctrl ds_vlvindex ds_addindex > > bin_SCRIPTS = admserv/newinst/src/register_server.pl > cgibin_SCRIPTS = admserv/cgi-src40/ds_create admserv/cgi-src40/ds_remove >-nodist_cmdbin_SCRIPTS = admserv/cfgstuff/start-ds-admin admserv/cfgstuff/stop-ds-admin admserv/cfgstuff/restart-ds-admin >+nodist_cmdbin_SCRIPTS = admserv/cfgstuff/start-ds-admin admserv/cfgstuff/stop-ds-admin admserv/cfgstuff/restart-ds-admin admserv/cfgstuff/ds_removal > > cmdbin_SCRIPTS = admserv/newinst/src/setup-ds-admin.pl \ > admserv/newinst/src/migrate-ds-admin.pl > >Index: admserv/cgi-src40/ds_remove.in >=================================================================== >RCS file: /cvs/dirsec/adminserver/admserv/cgi-src40/ds_remove.in,v >retrieving revision 1.2 >diff -t -w -U4 -r1.2 ds_remove.in >--- admserv/cgi-src40/ds_remove.in 11 Jul 2007 21:36:47 -0000 1.2 >+++ admserv/cgi-src40/ds_remove.in 18 Jul 2007 01:22:17 -0000 >@@ -49,18 +49,26 @@ > use Util; > use FileConn; > use Resource; > >+# remove_tree($centry, $key, $instname, [$isparent, [$dontremove]]) >+# $centry: entry to look for the path to be removed >+# $key: key to look for the path in the entry >+# $instname: instance name "slapd-<ID>" to check the path >+# $isparent: specify 1 to remove from the parent dir >+# $dontremove: pattern not to be removed (e.g., ".db$") > sub remove_tree > { > my $centry = shift; > my $key = shift; > my $instname = shift; > my $isparent = shift; >+ my $dontremove = shift; > > foreach my $path ( @{$centry->{$key}} ) > { > my $rmdir = ""; >+ my $rc = 0; > if ( 1 == $isparent ) > { > $rmdir = dirname($path); > } >@@ -69,10 +77,57 @@ > $rmdir = $path; > } > if ( -d $rmdir && $rmdir =~ /$instname/ ) > { >- my $rc = rmtree($rmdir); >- print STDERR "rmtree: $rmdir => RC: $rc\n"; >+ if ( "" eq "$dontremove" ) >+ { >+ $rc = rmtree($rmdir); >+ if ( 0 == $rc ) >+ { >+ print "Content-type: text/plain\n\n"; >+ print "NMC_ErrInfo: $rmdir was not removed.\n"; >+ print STDERR "Warning: $rmdir was not removed.\n"; >+ } >+ } >+ else >+ { >+ # Skip the dontremove files >+ $rc = opendir(DIR, $rmdir); >+ if ($rc) >+ { >+ while (defined(my $file = readdir(DIR))) >+ { >+ next if ( "$file" =~ /$dontremove/ ); >+ next if ( "$file" eq "." ); >+ next if ( "$file" eq ".." ); >+ my $rmfile = $rmdir . "/" . $file; >+ my $rc0 = rmtree($rmfile); >+ if ( 0 == $rc0 ) >+ { >+ print "Content-type: text/plain\n\n"; >+ print "NMC_ErrInfo: $rmfile was not removed.\n"; >+ print STDERR "Warning: $rmfile was not removed.\n"; >+ } >+ } >+ closedir(DIR); >+ } >+ my $newrmdir = $rmdir . ".removed"; >+ my $rc1 = 1; >+ if ( -d $newrmdir ) >+ { >+ $rc1 = rmtree($newrmdir); >+ if ( 0 == $rc1 ) >+ { >+ print "Content-type: text/plain\n\n"; >+ print "NMC_ErrInfo: $newrmdir was not removed.\n"; >+ print STDERR "Warning: $newrmdir was not removed.\n"; >+ } >+ } >+ if ( 0 < $rc1 ) >+ { >+ rename($rmdir, $newrmdir); >+ } >+ } > } > } > } > >@@ -102,14 +157,25 @@ > $ENV{QUERY_STRING} = $query->query_string(); > > my $instname = $query->param('InstanceName'); > my ($slapd, $inst) = split(/-/, $instname, 2); >+my $configdir = "@instconfigdir@/slapd-$inst"; >+if ( ! -d $configdir ) >+{ >+ print "Content-type: text/plain\n\n"; >+ print "NMC_ErrInfo: $configdir does not exist\n"; >+ print "NMC_Status: 1\n"; >+ print STDERR "Error: $configdir does not exist\n"; >+ exit 1; >+} > my @errs; >-my $inf = createInfFromConfig("@instconfigdir@/slapd-$inst", $inst, \@errs); >-if (@errs) { >+my $inf = createInfFromConfig($configdir, $inst, \@errs); >+if (@errs) >+{ > print "Content-type: text/plain\n\n"; > print "NMC_ErrInfo: ", $res->getText(@errs), "\n"; > print "NMC_Status: 1\n"; >+ print STDERR "Error: ", $res->getText(@errs), "\n"; > exit 1; > } > > # add the parmeters necessary to configure this DS to be managed >@@ -127,16 +193,45 @@ > my $conn = new FileConn($dseldif); > > my $dn = "cn=config"; > my $entry = $conn->search($dn, "base", "(cn=*)", 0); >-if (!$entry) { >+if (!$entry) >+{ > print "Content-type: text/plain\n\n"; > print "NMC_ErrInfo: Search $dn in $dseldif failed: $entry\n"; > print "NMC_Status: 1\n"; >+ print STDERR "Error: Search $dn in $dseldif failed: $entry\n"; >+ exit 1; >+} >+ >+# Unregister the server from the configuration ds >+# get config ds url from input or admconf >+# get admin id from input or admconf >+# must get admin password from input (PASSWORD_PIPE?) >+# get admin domain >+# config ds info >+if (!unregisterDSWithConfigDS($inst, \@errs, $inf)) >+{ >+ print "Content-type: text/plain\n\n"; >+ print "NMC_ErrInfo: ", $res->getText(@errs), "\n"; >+ print "NMC_Status: 1\n"; >+ print STDERR "Error:", $res->getText(@errs), "\n"; > exit 1; > } > >-# stop the server first >+$dn = "cn=config,cn=ldbm database,cn=plugins,cn=config"; >+my $dbentry = $conn->search($dn, "base", "(cn=*)", 0); >+if (!$dbentry) >+{ >+ print "Content-type: text/plain\n\n"; >+ print "NMC_ErrInfo: Search $dn in $dseldif failed: $dbentry\n"; >+ print "NMC_Status: 1\n"; >+ print "Error: Search $dn in $dseldif failed: $dbentry\n"; >+ exit 1; >+} >+$conn->close(); >+ >+# stop the server > my $instdir = ""; > foreach my $path ( @{$entry->{"nsslapd-instancedir"}} ) > { > if ( -d $path ) >@@ -150,58 +245,53 @@ > if ($status) { > # Ignore the stop failure > print "Content-type: text/plain\n\n"; > print "NMC_ErrInfo: Could not stop directory server: $output\n"; >+ print STDERR "Warning: Could not stop directory server: $output\n"; > } > $instdir = $path; # need to use it later... > } else { > print "Content-type: text/plain\n\n"; > print "NMC_ErrInfo: The program $prog does not exist\n"; > print "NMC_Status: 1\n"; >+ print STDERR "Error: The program $prog does not exist\n"; > exit 1; > } > } > } > >-# Unregister the server from the configuration ds >-# get config ds url from input or admconf >-# get admin id from input or admconf >-# must get admin password from input (PASSWORD_PIPE?) >-# get admin domain >-# config ds info >-if (!unregisterDSWithConfigDS($inst, \@errs, $inf)) { >- print "Content-type: text/plain\n\n"; >- print "NMC_ErrInfo: ", $res->getText(@errs), "\n"; >- print "NMC_Status: 1\n"; >- exit 1; >-} >- > # remove physical dirs/files >-$dn = "cn=config,cn=ldbm database,cn=plugins,cn=config"; >-my $dbentry = $conn->search($dn, "base", "(cn=*)", 0); >-if (!$dbentry) { >- print "Content-type: text/plain\n\n"; >- print "NMC_ErrInfo: Search $dn in $dseldif failed: $dbentry\n"; >- print "NMC_Status: 1\n"; >- exit 1; >-} > remove_tree($dbentry, "nsslapd-directory", $instname, 1); > remove_tree($dbentry, "nsslapd-db-logdirectory", $instname, 1); > remove_tree($entry, "nsslapd-lockdir", $instname); > remove_tree($entry, "nsslapd-tmpdir", $instname); > remove_tree($entry, "nsslapd-bakdir", $instname, 1); > remove_tree($entry, "nsslapd-errorlog", $instname, 1); >-remove_tree($entry, "nsslapd-schemadir", $instname, 1); > > # instance dir >-if ( -d $instdir ) >+if ( -d $instdir && $instdir =~ /$instname/ ) > { > # clean up pid files (if any) > remove_pidfile("STARTPIDFILE", $instdir, $instname); > remove_pidfile("PIDFILE", $instdir, $instname); > >+ if ( 1 == isConfigDS($instname, "@instconfigdir@/admin-serv") ) >+ { >+ # if it is the Config DS, adm.conf and local.conf needs to be removed. >+ unlink("@instconfigdir@/admin-serv/adm.conf"); >+ unlink("@instconfigdir@/admin-serv/local.conf"); >+ } >+ > my $rc = rmtree($instdir); >+ if ( 0 == $rc ) >+ { >+ print "Content-type: text/plain\n\n"; >+ print "NMC_ErrInfo: $instdir was not removed.\n"; >+ print STDERR "Warning: $instdir was not removed.\n"; >+ } > } >+# Finally, config dir >+remove_tree($entry, "nsslapd-schemadir", $instname, 1, "\.db\$"); > > # if we got here, report success > print "Content-type: text/plain\n\n"; > print "NMC_Status: 0\n"; >Index: admserv/newinst/src/AdminUtil.pm.in >=================================================================== >RCS file: /cvs/dirsec/adminserver/admserv/newinst/src/AdminUtil.pm.in,v >retrieving revision 1.10 >diff -t -w -U4 -r1.10 AdminUtil.pm.in >--- admserv/newinst/src/AdminUtil.pm.in 13 Jul 2007 18:39:15 -0000 1.10 >+++ admserv/newinst/src/AdminUtil.pm.in 18 Jul 2007 01:22:17 -0000 >@@ -42,14 +42,14 @@ > @EXPORT = qw(getAdmConf getConfigDSConn createConfigDS createSubDS > updateAdmConf updateAdmpw updateLocalConf importCACert > getLocalConfigDS getPset registerDSWithConfigDS > registerManyDSWithConfigDS createSubDSNoConn >- unregisterDSWithConfigDS); >+ unregisterDSWithConfigDS isConfigDS); > @EXPORT_OK = qw(getAdmConf getConfigDSConn createConfigDS createSubDS > updateAdmConf updateAdmpw updateLocalConf importCACert > getLocalConfigDS getPset registerDSWithConfigDS > registerManyDSWithConfigDS createSubDSNoConn >- unregisterDSWithConfigDS); >+ unregisterDSWithConfigDS isConfigDS); > > # load perldap > use Mozilla::LDAP::Conn; > use Mozilla::LDAP::Utils qw(normalizeDN); >@@ -149,8 +149,21 @@ > # for now, same as admin server config dir > return "$configdir/admin-serv"; > } > >+sub isConfigDS { >+ my $inst = shift; >+ my $configdir = shift; >+ my $admConf = getAdmConf ($configdir); >+ my $ldapstart = $admConf->{ldapStart}; >+ my $expected = $inst . "/start-slapd"; >+ if ( "$ldapstart" eq "$expected" ) { >+ return 1; >+ } else { >+ return 0; >+ } >+} >+ > sub getConfigDSConn { > my $url = shift; > my $id = shift; > my $pwd = shift;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 247215
:
158634
|
158635
|
158676
|
158876
|
158879
|
158913
|
158917
|
158918
|
158919
|
159392
|
159393
| 159487 |
160087