ldap/admin/src/scripts/DSCreate.pm.in | 11 ++++++++---
ldap/admin/src/scripts/remove-ds.pl.in | 6 ++++--
2 files changed, 12 insertions(+), 5 deletions(-)
New commits:
commit c013442930d30e81bb30fea22fe007b6645ecf62
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Mon Feb 13 15:45:45 2012 -0800
Trac Ticket #34 - remove-ds.pl does not remove everything
https://fedorahosted.org/389/ticket/34
Fix description: Introduce an option "--all | -a", with which
all the generated files and directories are removed.
diff --git a/ldap/admin/src/scripts/DSCreate.pm.in
b/ldap/admin/src/scripts/DSCreate.pm.in
index 00d290c..7bb4595 100644
--- a/ldap/admin/src/scripts/DSCreate.pm.in
+++ b/ldap/admin/src/scripts/DSCreate.pm.in
@@ -1224,6 +1224,7 @@ sub stopServer {
sub removeDSInstance {
my $inst = shift;
my $force = shift;
+ my $all = shift;
my $initconfig_dir = shift || get_initconfigdir();
my $baseconfigdir = $ENV{DS_CONFIG_DIR} || "@instconfigdir@";
my $instname = "slapd-$inst";
@@ -1314,8 +1315,8 @@ sub removeDSInstance {
push @errs, remove_tree($dbentry, "nsslapd-db-logdirectory", $instname,
1);
}
if ($entry) {
- push @errs, remove_tree($entry, "nsslapd-lockdir", $instname);
- push @errs, remove_tree($entry, "nsslapd-tmpdir", $instname);
+ push @errs, remove_tree($entry, "nsslapd-lockdir", $instname, 0);
+ push @errs, remove_tree($entry, "nsslapd-tmpdir", $instname, 0);
push @errs, remove_tree($entry, "nsslapd-bakdir", $instname, 1);
push @errs, remove_tree($entry, "nsslapd-errorlog", $instname, 1);
}
@@ -1335,7 +1336,11 @@ sub removeDSInstance {
}
}
# Finally, config dir
- push @errs, remove_tree($entry, "nsslapd-schemadir", $instname, 1,
"\.db\$");
+ if ($all) {
+ push @errs, remove_tree($entry, "nsslapd-schemadir", $instname, 1);
+ } else {
+ push @errs, remove_tree($entry, "nsslapd-schemadir", $instname, 1,
"\.db\$");
+ }
# Remove the instance specific initconfig script
if ( -f $initconfig ) {
diff --git a/ldap/admin/src/scripts/remove-ds.pl.in
b/ldap/admin/src/scripts/remove-ds.pl.in
index 5eee37d..5f42615 100755
--- a/ldap/admin/src/scripts/remove-ds.pl.in
+++ b/ldap/admin/src/scripts/remove-ds.pl.in
@@ -43,12 +43,14 @@ sub usage {
my $force = "";
my $instname = "";
my $initconfig_dir = "";
+my $all = "";
GetOptions('help|h|?' => sub { &usage; exit(1); },
'debug|d+' => \$DSUtil::debuglevel,
'instance|i=s' => \$instname,
'initconfig_dir|c=s' => \$initconfig_dir,
- 'force|f' => \$force
+ 'force|f' => \$force,
+ 'all|a' => \$all
);
# Make sure the instance name option was provided.
@@ -63,7 +65,7 @@ unless ($inst) {
exit 1;
}
-my @errs = removeDSInstance($inst, $force, $initconfig_dir);
+my @errs = removeDSInstance($inst, $force, $all, $initconfig_dir);
if (@errs) {
print STDERR "The following errors occurred during removal:\n";
for (@errs) {