Alex Lourie has uploaded a new change for review. Change subject: packaging: removed encodingvalidator utility ......................................................................
packaging: removed encodingvalidator utility This patch removes encodingvalidator utility as it is no longer used. Change-Id: I583b115cf60142cafc5ba66b0dc22e92b4807c84 Signed-off-by: Alex Lourie <[email protected]> --- M Makefile D backend/manager/tools/dbutils/encodingvalidator.sh M backend/manager/tools/dbutils/validatedb.sh M packaging/fedora/setup/engine-upgrade.py 4 files changed, 3 insertions(+), 125 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/15/14615/1 diff --git a/Makefile b/Makefile index d604d72..48f0eaa 100644 --- a/Makefile +++ b/Makefile @@ -335,7 +335,6 @@ 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 750 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 deleted file mode 100755 index bdf7d31..0000000 --- a/backend/manager/tools/dbutils/encodingvalidator.sh +++ /dev/null @@ -1,121 +0,0 @@ -############################################################################################################### -# The purpose of this utility is to find not UTF8 template1 encoding , display it and enable to fix it -# Only support may access this utility with care -# Use the -f flag to fix the problem by removing and recreating template1 with UTF8 encoding. -# Running this utility without the -f flag will only report the default encoding for template1. -# It is highly recomended to backup the database before using this utility. -############################################################################################################### - -#!/bin/bash -#include db general functions -pushd $(dirname ${0})>/dev/null -source ./common.sh - -#setting defaults -set_defaults - - -usage() { - 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" - printf "\t-u USERNAME - The username for the database (def. engine)\n" - printf "\t-l LOGFILE - The logfile for capturing output (def. ${LOGFILE})\n" - printf "\t-f - Fix the template1 database encoding to be UTF8.\n" - printf "\t-q - Quiet operation: do not ask questions, assume 'yes' when fixing.\n" - printf "\t-v - Turn on verbosity (WARNING: lots of output)\n" - printf "\t-h - This help text.\n" - printf "\n" - popd>/dev/null - exit $ret -} - -DEBUG () { - if $VERBOSE; then - printf "DEBUG: $*" - fi -} - -FIXIT=false -QUIET=false - -while getopts hs:u:p:l:d:qfv 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;; - esac -done - -run() { - command="${1}" - db="${2}" - psql --pset=tuples_only=on -w -U ${USERNAME} -h ${SERVERNAME} -p ${PORT} -c "${command}" ${db} > /dev/null -} - -get() { - CMD="SELECT pg_encoding_to_char(encoding) FROM pg_database WHERE datname = 'template1';" - encoding=$(psql --pset=tuples_only=on -w -U ${USERNAME} -h ${SERVERNAME} -p ${PORT} -c "${CMD}" template1) - echo "${encoding}" | sed -e 's/^ *//g' -} - -fix_template1_encoding() { - #Allow connecting to template 0 - CMD="UPDATE pg_database SET datallowconn = TRUE WHERE datname = 'template0';" - run "${CMD}" template1 - #Define template1 as a regular DB so we can drop it - CMD="UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';" - run "${CMD}" template0 - #drop tempalte1 - CMD="drop database template1;" - run "${CMD}" template0 - #recreate template1 with same encoding as template0 - CMD="create database template1 with template = template0;" - run "${CMD}" template0 - #restore changed defaults for template1 - CMD="UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';" - run "${CMD}" template0 - #restore changed defaults for template0 - CMD="UPDATE pg_database SET datallowconn = FALSE WHERE datname = 'template0';" - run "${CMD}" template1 -} - -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 - - if [ "${answer}" != "y" ]; then - echo "Please contact support for further assistance." - popd>/dev/null - exit 1 - fi -fi - -encoding=$(get) - -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 - -if [ $? -eq 0 ]; then - echo "Operation completed successfully" -else - echo "Operation failed" -fi - -popd>/dev/null -exit $? diff --git a/backend/manager/tools/dbutils/validatedb.sh b/backend/manager/tools/dbutils/validatedb.sh index de0c116..8662e94 100755 --- a/backend/manager/tools/dbutils/validatedb.sh +++ b/backend/manager/tools/dbutils/validatedb.sh @@ -57,7 +57,7 @@ esac done -validationlist="fkvalidator.sh encodingvalidator.sh" +validationlist="fkvalidator.sh" for script in ${validationlist}; do $dbutils/${script} ${USERNAME} ${SERVERNAME} ${PORT} ${DATABASE} -q ${extra_params} || error=1 diff --git a/packaging/fedora/setup/engine-upgrade.py b/packaging/fedora/setup/engine-upgrade.py index f348d5d..abd495b 100755 --- a/packaging/fedora/setup/engine-upgrade.py +++ b/packaging/fedora/setup/engine-upgrade.py @@ -1086,7 +1086,7 @@ cmd = [ basedefs.EXEC_DBVALIDATOR, "--user={admin}".format( - admin=utils.getDbAdminUser(), + admin=SERVER_ADMIN, ), "--host={host}".format( host=SERVER_NAME @@ -1119,7 +1119,7 @@ cmd = [ basedefs.EXEC_DBVALIDATOR, "--user={admin}".format( - admin=utils.getDbAdminUser(), + admin=SERVER_ADMIN, ), "--host={host}".format( host=SERVER_NAME -- To view, visit http://gerrit.ovirt.org/14615 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I583b115cf60142cafc5ba66b0dc22e92b4807c84 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Alex Lourie <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
