Alex Lourie has uploaded a new change for review.

Change subject: packaging: Added encodingvalidator.sh to validation list
......................................................................

packaging: Added encodingvalidator.sh to validation list

This patch updates encodingvalidator.sh utility and adds
it to the list of executed validators in validatedb.sh
generic script.

Change-Id: Ic89088c7738eb379b2bc88d8d59193d4ed20a295
Bug-Url: https://bugzilla.redhat.com/920565
Signed-off-by: Alex Lourie <alou...@redhat.com>
---
M Makefile
M backend/manager/tools/dbutils/encodingvalidator.sh
M backend/manager/tools/dbutils/validatedb.sh
3 files changed, 10 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/89/14389/1

diff --git a/Makefile b/Makefile
index e8b104b..6bb7dc7 100644
--- a/Makefile
+++ b/Makefile
@@ -319,6 +319,7 @@
        install -m 640 backend/manager/tools/dbutils/taskcleaner_sp.sql 
$(DESTDIR)$(DATA_DIR)/scripts/dbutils
        install -m 750 backend/manager/tools/dbutils/fkvalidator.sh 
$(DESTDIR)$(DATA_DIR)/scripts/dbutils
        install -m 640 backend/manager/tools/dbutils/fkvalidator_sp.sql 
$(DESTDIR)$(DATA_DIR)/scripts/dbutils
+       install -m 640 backend/manager/tools/dbutils/encodingvalidator.sh 
$(DESTDIR)$(DATA_DIR)/scripts/dbutils
        install -m 750 backend/manager/tools/dbutils/validatedb.sh 
$(DESTDIR)$(DATA_DIR)/scripts/dbutils
 
 install_aio_plugin:
diff --git a/backend/manager/tools/dbutils/encodingvalidator.sh 
b/backend/manager/tools/dbutils/encodingvalidator.sh
index 0c0c50a..830d809 100755
--- a/backend/manager/tools/dbutils/encodingvalidator.sh
+++ b/backend/manager/tools/dbutils/encodingvalidator.sh
@@ -16,7 +16,7 @@
 
 
 usage() {
-    printf "Usage: ${ME} [-h] [-s SERVERNAME [-p PORT]] [-u USERNAME] [-l 
LOGFILE] [-f] [-v]\n"
+    printf "Usage: ${ME} [-h] [-s SERVERNAME [-p PORT]] [-u USERNAME] [-l 
LOGFILE] [-q] [-f] [-v]\n"
     printf "\n"
     printf "\t-s SERVERNAME - The database servername for the database  (def. 
${SERVERNAME})\n"
     printf "\t-p PORT       - The database port for the database        (def. 
${PORT})\n"
@@ -37,14 +37,16 @@
 }
 
 FIXIT=false
+QUIET=false
 
-while getopts hs:u:p:l:fv option; do
+while getopts hs:u:p:l:qdfv option; do
     case $option in
         s) SERVERNAME=$OPTARG;;
         p) PORT=$OPTARG;;
         u) USERNAME=$OPTARG;;
         l) LOGFILE=$OPTARG;;
         f) FIXIT=true;;
+        q) QUIET=true;;
         v) VERBOSE=true;;
         h) ret=0 && usage;;
        \?) ret=1 && usage;;
@@ -84,7 +86,7 @@
     run "${CMD}" template1
 }
 
-if [ "${FIXIT}" = "true" ]; then
+if [[ "${FIXIT}" = "true" && "${QUIET}" == "false" ]; then
     echo "Caution, this operation should be used with care. Please contact 
support prior to running this command"
     echo "Are you sure you want to proceed? [y/n]"
     read answer
@@ -94,10 +96,6 @@
        popd>/dev/null
        exit 1
     fi
-else
-    encoding=$(get)
-    echo ${encoding}
-    exit 0
 fi
 
 encoding=$(get)
@@ -105,6 +103,9 @@
 if [[ "${encoding}" = "UTF8" || "${encoding}" = "utf8" ]]; then
    echo "Database template1 has already UTF8 default encoding configured. 
nothing to do, exiting..."
    exit 0
+elif [ "${FIXIT}" = "false" ]; then
+   echo "Database template1 is configured with an incompatible encoding: 
${encoding}"
+   exit 1
 fi
 
 fix_template1_encoding
diff --git a/backend/manager/tools/dbutils/validatedb.sh 
b/backend/manager/tools/dbutils/validatedb.sh
index 8662e94..de0c116 100755
--- a/backend/manager/tools/dbutils/validatedb.sh
+++ b/backend/manager/tools/dbutils/validatedb.sh
@@ -57,7 +57,7 @@
     esac
 done
 
-validationlist="fkvalidator.sh"
+validationlist="fkvalidator.sh encodingvalidator.sh"
 
 for script in ${validationlist}; do
         $dbutils/${script} ${USERNAME} ${SERVERNAME} ${PORT} ${DATABASE} -q 
${extra_params} || error=1


--
To view, visit http://gerrit.ovirt.org/14389
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic89088c7738eb379b2bc88d8d59193d4ed20a295
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alex Lourie <alou...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to