Alon Bar-Lev has posted comments on this change.

Change subject: packaging: Added generic DB validations before the upgrade
......................................................................


Patch Set 11: (4 inline comments)

....................................................
File backend/manager/tools/dbutils/validatedb.sh
Line 20:         server to use to connect to the DB
Line 21:     --port=port
Line 22:         server port to use to connect to the DB
Line 23:     --database=db
Line 24:         database to connect to
--fix is missing
Line 25: 
Line 26: __EOF__
Line 27:        exit 2
Line 28: }


Line 35:        case "${x}" in
Line 36:                --log=*)
Line 37:                ;;
Line 38:                --user=*)
Line 39:             USERNAME="-u ${v}"
decide spaces or tabs.
Line 40:                ;;
Line 41:                --host=*)
Line 42:             SERVERNAME="-s ${v}"
Line 43:                ;;


Line 58:                ;;
Line 59:        esac
Line 60: done
Line 61: 
Line 62: validationlist=(
avoid using array...

validationlist="script1 script2 script3"
Line 63: fkvalidator.sh
Line 64: )
Line 65: 
Line 66: 


Line 68: for script in ${validationlist}; do
Line 69:     if [ ${FIX} -eq 1 ]; then
Line 70:         $dbutils/${script} ${USERNAME} ${SERVERNAME} ${PORT} 
${DATABASE} -f -q || die "Error fixing DB"
Line 71:     else
Line 72:         out=`${dbutils}/${script} ${USERNAME} ${SERVERNAME} ${PORT} 
${DATABASE} | sed -e "s/^\s*//; s/\s*$//; /^$/d"`
Use multiple expressions as:

 sed -e 's/^\s*//' -e 's/\s*$//' -e '/^$^/d'

But why is it important to do this here, and not fix script not to output 
blanks?

Also, there is no problem in just letting output go to the setup...

I expect this to be:

 error=0
 extra_parms="${FIX:+-f}"
 for script in ${validationlist}; do
     $dbutils/${script} ${USERNAME} ${SERVERNAME} ${PORT} ${DATABASE} -q 
${extra_parms} || error=1
 done

 exit "${error}"

Now... I expect the script output with human readable text:

 Validating database: xxxx
 ERROR: found issue yyyy
 ERROR: found issue ZZZ

This way we can all output in human readable format out of the script without 
complex wrapper script.
Line 73:         if [ $? -ne 0 ]; then
Line 74:             die "Error checking DB"
Line 75:         fi
Line 76:         if [ -n "${out}" ]; then


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ief0e65231bb42b569734cdd2fa6491b645491f98
Gerrit-PatchSet: 11
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alex Lourie <alou...@redhat.com>
Gerrit-Reviewer: Alex Lourie <alou...@redhat.com>
Gerrit-Reviewer: Alon Bar-Lev <alo...@redhat.com>
Gerrit-Reviewer: Juan Hernandez <juan.hernan...@redhat.com>
Gerrit-Reviewer: Moran Goldboim <mgold...@redhat.com>
Gerrit-Reviewer: Ofer Schreiber <oschr...@redhat.com>
Gerrit-Reviewer: Sandro Bonazzola <sbona...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to