Adjust logic to allow for redeploy retry on failure

Previously if a redeploy failed during the process, if
you attempted to start it over, it would reprompt for the
version you were attempting to upgrade.  At this point in
process, you are already on the latest version of the code,
so putting the original code version would actually break
the leap.  This attempts to detect if a redeploy started
but didn't complete and asks the user if they would like
to reattempt the redeploy.

Change-Id: I7c2f734edc4ec3186be3d24a60ee41b43269d07b
This commit is contained in:
Antony Messerli 2017-09-12 10:17:35 -05:00
parent a3cde38df0
commit 16e5db982c
2 changed files with 20 additions and 1 deletions
leap-upgrades

@ -131,6 +131,17 @@ function bootstrap_recent_ansible {
popd
}
function resume_incomplete_leap {
echo
notice "Detected previous leap attempt to ${CODE_UPGRADE_FROM}."
notice 'Would you like to reattempt this leap upgrade?'
read -p 'Enter "YES" to continue:' RUSURE
if [[ "${RUSURE}" != "YES" ]]; then
notice "Quitting..."
exit 99
fi
}
function validate_upgrade_input {
echo
@ -278,7 +289,9 @@ function pre_flight {
discover_code_version
if [ "${VALIDATE_UPGRADE_INPUT}" == "TRUE" ]; then
if [[ -f "${CONFIG_DIR}/upgrade-leap/redeploy-started.complete" && ! -f "${CONFIG_DIR}/upgrade-leap/osa-leap.complete" ]]; then
resume_incomplete_leap
elif [ "${VALIDATE_UPGRADE_INPUT}" == "TRUE" ]; then
validate_upgrade_input
fi

@ -21,6 +21,12 @@ set -e -u
source lib/vars.sh
source lib/functions.sh
### Set lock file to notate redeploy has started
# Notate that redeploy has started, if it fails midway, it can be
# resumed from the starting script without getting prompted to
# set the version again.
touch /etc/openstack_deploy/upgrade-leap/redeploy-started.complete
### Run the redeploy tasks
# Forget about the old neutron agent container in inventory.
# This is done to maximize uptime by leaving the old systems in