diff --git a/scripts/run-upgrade.sh b/scripts/run-upgrade.sh index 55e17d50f9..113671e14d 100755 --- a/scripts/run-upgrade.sh +++ b/scripts/run-upgrade.sh @@ -56,6 +56,40 @@ function remove_inv_items(){ ./scripts/inventory-manage.py -f /etc/openstack_deploy/openstack_inventory.json -r "$1" } +function run_lock() { + set +e + run_item="${RUN_TASKS[$1]}" + upgrade_marker_file=$(basename $run_item .yml) + upgrade_marker="/etc/openstack_deploy/upgrade-juno/$upgrade_marker_file.complete" + + if [ ! -f "$upgrade_marker" ];then + openstack-ansible "$2" + echo "ran $run_item" + + if [ "$?" == "0" ];then + RUN_TASKS=("${RUN_TASKS[@]/$run_item}") + touch "$upgrade_marker" + echo "$run_item has been marked as success" + else + echo "******************** FAILURE ********************" + echo "The upgrade script has failed please rerun the following task to continue" + echo "Failed on task $run_item" + echo "Do NOT rerun the upgrade script!" + echo "Please execute the remaining tasks:" + # Run the tasks in order + for item in ${!RUN_TASKS[@]}; do + echo "${RUN_TASKS[$item]}" + done + echo "******************** FAILURE ********************" + exit 99 + fi + else + RUN_TASKS=("${RUN_TASKS[@]/$run_item.*}") + fi + set -e +} + + ## Main ---------------------------------------------------------------------- # Create new openstack_deploy directory. @@ -71,6 +105,10 @@ else exit 1 fi +if [ ! -d "/etc/openstack_deploy/upgrade-juno" ];then + mkdir -p "/etc/openstack_deploy/upgrade-juno" +fi + # Drop deprecation file. cat > /etc/rpc_deploy.OLD/DEPRECATED.txt < /tmp/fix_container_interfaces.yml < /tmp/ensure_container_networking.yml < /tmp/fix_swift_rings_locations.yml < /tmp/fix_swift_rings_locations.yml <