diff --git a/leap-upgrades/lib/functions.sh b/leap-upgrades/lib/functions.sh index 4c042c57..f0b56460 100644 --- a/leap-upgrades/lib/functions.sh +++ b/leap-upgrades/lib/functions.sh @@ -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 diff --git a/leap-upgrades/re-deploy.sh b/leap-upgrades/re-deploy.sh index 192a5e06..29bccd66 100755 --- a/leap-upgrades/re-deploy.sh +++ b/leap-upgrades/re-deploy.sh @@ -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