Merge "Properly parse and quote arguments in upgrade script"

This commit is contained in:
Jenkins
2015-08-07 15:16:30 +00:00
committed by Gerrit Code Review

View File

@@ -59,11 +59,28 @@ function remove_inv_items(){
function run_lock() {
set +e
run_item="${RUN_TASKS[$1]}"
upgrade_marker_file=$(basename $run_item .yml)
file_part="${run_item}"
# NOTE(sigmavirus24): This handles tasks like:
# "-e 'rabbitmq_upgrade=true' setup-infrastructure.yml"
# "/tmp/fix_container_interfaces.yml || true"
# So we can get the appropriate basename for the upgrade_marker
for part in $run_item; do
if [[ "$part" == *.yml ]];then
file_part="$part"
break
fi
done
upgrade_marker_file=$(basename ${file_part} .yml)
upgrade_marker="/etc/openstack_deploy/upgrade-juno/$upgrade_marker_file.complete"
if [ ! -f "$upgrade_marker" ];then
openstack-ansible "$2"
# NOTE(sigmavirus24): Use eval so that we properly turn strings like
# "/tmp/fix_container_interfaces.yml || true"
# Into a command, otherwise we'll get an error that there's no playbook
# named ||
eval "openstack-ansible $2"
echo "ran $run_item"
if [ "$?" == "0" ];then
@@ -631,6 +648,6 @@ pushd playbooks
# Run the tasks in order
for item in ${!RUN_TASKS[@]}; do
run_lock $item ${RUN_TASKS[$item]}
run_lock $item "${RUN_TASKS[$item]}"
done
popd