Add option to set FROM code and fix logic bug

The leap tooling was attempting to run `set_upgrade_vars` at point where
specific upgrade variables were already needed. Within this change that
function call is moved up a few lines so that it has the chance to set
the required values. Additionally the option to pre-define the variable
CODE_UPGRADE_FROM has been added giving the deployer the option to set
this variable before a leap upgrade is run.

Change-Id: I2c780eb46dd57e680fc8681824de2fe913824fd9
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2017-10-11 01:19:44 -05:00 committed by Kevin Carter (cloudnull)
parent cc9294bb0d
commit e7ea3b56c6
2 changed files with 10 additions and 10 deletions

View File

@ -274,6 +274,11 @@ function set_upgrade_vars {
export ANSIBLE_INVENTORY="/opt/leap42/openstack-ansible-${RELEASE}/playbooks/inventory" export ANSIBLE_INVENTORY="/opt/leap42/openstack-ansible-${RELEASE}/playbooks/inventory"
export CONFIG_DIR="/etc/openstack_deploy" export CONFIG_DIR="/etc/openstack_deploy"
;; ;;
*)
warning "The option CODE_UPGRADE_FROM is set to \"${CODE_UPGRADE_FROM}\""
failure "No CODE_UPGRADE_FROM match found. Please set CODE_UPGRADE_FROM before continuing."
exit 99
;;
esac esac
# Do not forget to export the TODOLIST if you run the scripts one by one. # Do not forget to export the TODOLIST if you run the scripts one by one.
warning "export UPGRADES_TO_TODOLIST=\"${UPGRADES_TO_TODOLIST}\"" warning "export UPGRADES_TO_TODOLIST=\"${UPGRADES_TO_TODOLIST}\""
@ -302,13 +307,10 @@ function pre_flight {
fi fi
fi fi
discover_code_version if [[ ! -n "${CODE_UPGRADE_FROM}" ]]; then
discover_code_version
# set config directory here since we need to check if existing redeploy fi
# has been kicked off before prompting for the release, JUNO is the only set_upgrade_vars
# other directory that may differ but since we aren't leaping to JUNO,
# this should be safe to set here
CONFIG_DIR="/etc/openstack_deploy"
if [[ -f "${CONFIG_DIR}/upgrade-leap/redeploy-started.complete" && ! -f "${CONFIG_DIR}/upgrade-leap/osa-leap.complete" ]]; then if [[ -f "${CONFIG_DIR}/upgrade-leap/redeploy-started.complete" && ! -f "${CONFIG_DIR}/upgrade-leap/osa-leap.complete" ]]; then
resume_incomplete_leap resume_incomplete_leap
@ -316,8 +318,6 @@ function pre_flight {
validate_upgrade_input validate_upgrade_input
fi fi
set_upgrade_vars
mkdir -p /opt/leap42/venvs mkdir -p /opt/leap42/venvs
# If the lxc backend store was not set halt and instruct the user to set it. In Juno we did more to detect the backend storage # If the lxc backend store was not set halt and instruct the user to set it. In Juno we did more to detect the backend storage

View File

@ -40,7 +40,7 @@ export UPGRADE_UTILS="${UPGRADE_UTILS:-${SYSTEM_PATH}/upgrade-utilities}"
export VENV_URL="${VENV_URL:-https://rpc-repo.rackspace.com/venvs/leap-bundles}" export VENV_URL="${VENV_URL:-https://rpc-repo.rackspace.com/venvs/leap-bundles}"
export VALIDATE_UPGRADE_INPUT="${VALIDATE_UPGRADE_INPUT:-TRUE}" export VALIDATE_UPGRADE_INPUT="${VALIDATE_UPGRADE_INPUT:-TRUE}"
export CODE_UPGRADE_FROM="" export CODE_UPGRADE_FROM="${CODE_UPGRADE_FROM:-}"
# Bootstrap ansible tool, see also bootstrap_recent_ansible # Bootstrap ansible tool, see also bootstrap_recent_ansible
export BOOTSTRAP_ANSIBLE_FOLDER=${BOOTSTRAP_ANSIBLE_FOLDER:-/opt/openstack-ansible/} export BOOTSTRAP_ANSIBLE_FOLDER=${BOOTSTRAP_ANSIBLE_FOLDER:-/opt/openstack-ansible/}