Eli Mesika has uploaded a new change for review. Change subject: core: rhevm-upgrade: encrypt vds_static pm_pass.. ......................................................................
core: rhevm-upgrade: encrypt vds_static pm_pass.. rhevm-upgrade: encrypt vds_static pm_password field on upgrade to 3.1 Adding check for store-utils.sh exit value and log an error message if password encryption fail for any host. In such a scenario, this host must be edited manually to set it PM properties. Change-Id: I5b99768d4bdec8673fc0c8c2b0f329f54701bede Signed-off-by: Eli Mesika <[email protected]> --- M backend/manager/dbscripts/upgrade/03_00_0420_encrypt_pm_passwd.sh 1 file changed, 10 insertions(+), 5 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/04/7704/1 diff --git a/backend/manager/dbscripts/upgrade/03_00_0420_encrypt_pm_passwd.sh b/backend/manager/dbscripts/upgrade/03_00_0420_encrypt_pm_passwd.sh index 59d332e..f2a1052 100755 --- a/backend/manager/dbscripts/upgrade/03_00_0420_encrypt_pm_passwd.sh +++ b/backend/manager/dbscripts/upgrade/03_00_0420_encrypt_pm_passwd.sh @@ -17,7 +17,7 @@ # get all hosts that have PM configured (vds_id and pm_password) filename=$(mktemp) -CMD="select vds_id,pm_password from vds_static where pm_enabled = true;" +CMD="select vds_id,vds_name,pm_password from vds_static where pm_enabled = true;" execute_command "${CMD}" "${DATABASE}" ${SERVERNAME} ${PORT} > ${filename} while read line do @@ -26,12 +26,17 @@ continue fi hostId=$(echo "${line}" | cut -d "|" -f1 | sed 's/^ *//g' | tr -d ' ') - pmPasswd=$(echo "${line}" | cut -d "|" -f2 | sed 's/^ *//g' | tr -d ' ') + hostName=$(echo "${line}" | cut -d "|" -f2 | sed 's/^ *//g' | tr -d ' ') + pmPasswd=$(echo "${line}" | cut -d "|" -f3 | sed 's/^ *//g' | tr -d ' ') if [ "$hostId" != "" -a "$pmPasswd" != "" ]; then # encrypt the password encryptedPasswd=$(${caBaseDir}/store-utils.sh -enc ${keystore} ${passwd} ${alias} ${pmPasswd} ${ear}) - # update the pm_password field for the given host - CMD="update vds_static set pm_password = '${encryptedPasswd}' where vds_id = '${hostId}';" - execute_command "${CMD}" "${DATABASE}" ${SERVERNAME} ${PORT} > /dev/null + if [ $? -ne 0 ]; then + echo "Failed to encrypt host ${hostName} Power Management password, please set host Power Management manually for this host." + else + # update the pm_password field for the given host + CMD="update vds_static set pm_password = '${encryptedPasswd}' where vds_id = '${hostId}';" + execute_command "${CMD}" "${DATABASE}" ${SERVERNAME} ${PORT} > /dev/null + fi fi done < ${filename} -- To view, visit http://gerrit.ovirt.org/7704 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I5b99768d4bdec8673fc0c8c2b0f329f54701bede Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Eli Mesika <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
