ldap/admin/src/scripts/db2index.in | 29 +++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)
New commits:
commit 5a33dc002205d2167c786dd2c05f23218f28341d
Author: Noriko Hosoi <nhosoi(a)redhat.com>
Date: Wed Feb 17 12:24:14 2016 -0800
Ticket #48662 - db2index with no attribute args fail.
Description: db2index should allow no option to reindex all.
Plus, this patch gets rid of unnecessary output from the server.
https://fedorahosted.org/389/ticket/48662
Reviewed by wibrown(a)redhat.com (Thank you, William!!)
diff --git a/ldap/admin/src/scripts/db2index.in b/ldap/admin/src/scripts/db2index.in
index c8e9075..ad28757 100755
--- a/ldap/admin/src/scripts/db2index.in
+++ b/ldap/admin/src/scripts/db2index.in
@@ -52,12 +52,6 @@ do
esac
done
-if [ -z $benameopt ] && [ -z $includeSuffix ]
-then
- usage
- exit 1;
-fi
-
initfile=$(get_init_file "@initconfigdir@" $servid)
if [ $? -eq 1 ]
then
@@ -67,17 +61,32 @@ then
exit 1
fi
+idxall=0
+print_usage=0
+if [ -z $servid ] && [ $# -eq 0 ]; then
+ idxall=1
+elif [ "$servid" ] && [ $# -eq 2 ]; then
+ idxall=1
+elif [ -z $benameopt ] && [ -z $includeSuffix ]; then
+ print_usage=1
+fi
+if [ -z $servid ] && [ $# -lt 2 ]; then
+ print_usage=1
+elif [ "$servid" ] && [ $# -lt 4 ]; then
+ print_usage=1
+fi
+
servid=`normalize_server_id $initfile`
. $initfile
-if [ $# -eq 0 ]
+if [ $idxall -eq 1 ]
then
bak_dir=@localstatedir@/lib/@PACKAGE_NAME@/slapd-$servid/bak/reindex_`date
+%Y_%m_%d_%H_%M_%S`
- @sbindir@/ns-slapd upgradedb -D $CONFIG_DIR -a "$bak_dir"
-elif [ $# -lt 2 ]
+ @sbindir@/ns-slapd upgradedb -D $CONFIG_DIR -a "$bak_dir" -f |& egrep
-v "util_info_sys_page|check_and_set_import_cache|WARNING|Backing up" | sed -e
"s/upgrade DB/Reindex/" | sed -e "s/upgradedb/reindexing/"
+elif [ $print_usage -eq 1 ]
then
usage
exit 1
else
- eval @sbindir@/ns-slapd db2index -D $CONFIG_DIR $args
+ eval @sbindir@/ns-slapd db2index -D $CONFIG_DIR $args |& egrep -v
"util_info_sys_page|check_and_set_import_cache|WARNING|Backing up" | sed -e
"s/upgrade DB/Reindex/" | sed -e "s/upgradedb/reindexing/"
fi