From 53d548dfba6a8a45c6c7afa6c8550fe76cfd4663 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Tue, 29 Aug 2017 11:42:25 +0100 Subject: [PATCH] Correct re-deploy hooks to allow unset variables The patch https://review.openstack.org/498167 added hooks which failed due to the '-u' set in the script which does not tolerate unset variables. The script has been modified to use parameter expansion to allow each hook to be detected properly as being set without failing due to unset variables. Change-Id: Ic7dd889a2f00de8a59239abb37b2d451e854ef63 --- leap-upgrades/re-deploy.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/leap-upgrades/re-deploy.sh b/leap-upgrades/re-deploy.sh index 97971485..f89e3698 100755 --- a/leap-upgrades/re-deploy.sh +++ b/leap-upgrades/re-deploy.sh @@ -42,7 +42,7 @@ link_release "/opt/leap42/openstack-ansible-${NEWTON_RELEASE}" RUN_TASKS=() # Pre-setup-hosts hook -if [ -n "$PRE_SETUP_HOSTS_HOOK" ]; then +if [[ -n ${PRE_SETUP_HOSTS_HOOK+x} ]]; then RUN_TASKS+=("$PRE_SETUP_HOSTS_HOOK") fi @@ -62,12 +62,12 @@ RUN_TASKS+=("lxc-hosts-setup.yml") RUN_TASKS+=("lxc-containers-create.yml") # Post-setup-hosts hook -if [ -n "$POST_SETUP_HOSTS_HOOK" ]; then +if [[ -n ${POST_SETUP_HOSTS_HOOK+x} ][; then RUN_TASKS+=("$POST_SETUP_HOSTS_HOOK") fi # Pre-setup-infrastructure hook -if [ -n "$PRE_SETUP_INFRASTRUCTURE_HOOK" ]; then +if [[ -n ${PRE_SETUP_INFRASTRUCTURE_HOOK+x} ]]; then RUN_TASKS+=("$PRE_SETUP_INFRASTRUCTURE_HOOK") fi @@ -87,12 +87,12 @@ RUN_TASKS+=("rsyslog-install.yml") RUN_TASKS+=("${UPGRADE_UTILS}/db-force-upgrade.yml") # Post-setup-infrastructure hook -if [ -n "$POST_SETUP_INFRASTRUCTURE_HOOK" ]; then +if [[ -n ${POST_SETUP_INFRASTRUCTURE_HOOK+x} ]]; then RUN_TASKS+=("$POST_SETUP_INFRASTRUCTURE_HOOK") fi # Pre-setup-openstack hook -if [ -n "$PRE_SETUP_OPENSTACK_HOOK" ]; then +if [[ -n ${PRE_SETUP_OPENSTACK_HOOK+x} ]; then RUN_TASKS+=("$PRE_SETUP_OPENSTACK_HOOK") fi @@ -132,7 +132,7 @@ RUN_TASKS+=("os-sahara-install.yml") RUN_TASKS+=("${UPGRADE_UTILS}/post-redeploy-cleanup.yml") # Post-setup-openstack hook -if [ -n "$POST_SETUP_OPENSTACK_HOOK" ]; then +if [[ -n ${POST_SETUP_OPENSTACK_HOOK+x} ]]; then RUN_TASKS+=("$POST_SETUP_OPENSTACK_HOOK") fi