Fix bash comparisons for grenade multinode switch

It seems, however variables are getting set with grenade
in native zuulv3 jobs, the environment variables are no
longer comparing as they once did in standard bash jobs.

What worked previously, was [ "$VAR" == 'value' ], however
when comparing the newer grenade node jobs we see things like
[[ subnode != \s\u\b\n\o\d\e ]] returning true when single
quotes are used.

Comparison in the logs to where double quotes were used for
functionally the same comparision, revealed proper processing
and execution as expected.

As such, changing our single quotes to double quotes where
applicable.

For the record, I also quickly checked codesearch and it looks
like we were the only project to use single quotes for this
comparison.

Change-Id: I2db2e870e2c5f32aa061af025ee7ce12c4f7c049
This commit is contained in:
Julia Kreger 2020-02-04 11:13:31 -08:00 committed by Iury Gregory Melo Ferreira
parent 6ceec86ad4
commit ad6ea7cf26
2 changed files with 8 additions and 8 deletions

View File

@ -432,11 +432,11 @@ IRONIC_PROVISION_SUBNET_SUBNODE_IP=${IRONIC_PROVISION_SUBNET_SUBNODE_IP:-'10.0.5
# Example: IRONIC_PROVISION_SUBNET_PREFIX=10.0.5.0/24
IRONIC_PROVISION_SUBNET_PREFIX=${IRONIC_PROVISION_SUBNET_PREFIX:-'10.0.5.0/24'}
if [[ "$HOST_TOPOLOGY_ROLE" == 'primary' ]]; then
if [[ "$HOST_TOPOLOGY_ROLE" == "primary" ]]; then
IRONIC_TFTPSERVER_IP=$IRONIC_PROVISION_SUBNET_GATEWAY
IRONIC_HTTP_SERVER=$IRONIC_PROVISION_SUBNET_GATEWAY
fi
if [[ "$HOST_TOPOLOGY_ROLE" == 'subnode' ]]; then
if [[ "$HOST_TOPOLOGY_ROLE" == "subnode" ]]; then
IRONIC_TFTPSERVER_IP=$IRONIC_PROVISION_SUBNET_SUBNODE_IP
IRONIC_HTTP_SERVER=$IRONIC_PROVISION_SUBNET_SUBNODE_IP
fi
@ -557,7 +557,7 @@ fi
# TODO(dtantsur): change this when we change the default value.
IRONIC_DEFAULT_BOOT_OPTION=${IRONIC_DEFAULT_BOOT_OPTION:-netboot}
if [ $IRONIC_DEFAULT_BOOT_OPTION != 'netboot' ] && [ $IRONIC_DEFAULT_BOOT_OPTION != 'local' ]; then
if [ $IRONIC_DEFAULT_BOOT_OPTION != "netboot" ] && [ $IRONIC_DEFAULT_BOOT_OPTION != "local" ]; then
die $LINENO "Supported values for IRONIC_DEFAULT_BOOT_OPTION are 'netboot' and 'local' only."
fi
@ -653,7 +653,7 @@ function is_ironic_enabled {
}
function is_deployed_by_agent {
[[ -z "${IRONIC_DEPLOY_DRIVER%%agent*}" || "$IRONIC_DEFAULT_DEPLOY_INTERFACE" == 'direct' ]] && return 0
[[ -z "${IRONIC_DEPLOY_DRIVER%%agent*}" || "$IRONIC_DEFAULT_DEPLOY_INTERFACE" == "direct" ]] && return 0
return 1
}
@ -1191,7 +1191,7 @@ function configure_ironic_provision_network {
local ironic_provision_network_ip
# NOTE(vsaienko) For multinode case there is no need to create a new provisioning
# network on subnode, as it was created on primary node. Just get an existed network UUID.
if [[ "$HOST_TOPOLOGY_ROLE" != 'subnode' ]]; then
if [[ "$HOST_TOPOLOGY_ROLE" != "subnode" ]]; then
die_if_not_set $LINENO IRONIC_PROVISION_SUBNET_PREFIX "You must specify the IRONIC_PROVISION_SUBNET_PREFIX"
die_if_not_set $LINENO PHYSICAL_NETWORK "You must specify the PHYSICAL_NETWORK"
die_if_not_set $LINENO IRONIC_PROVISION_SUBNET_GATEWAY "You must specify the IRONIC_PROVISION_SUBNET_GATEWAY"
@ -2285,7 +2285,7 @@ function enroll_nodes {
provide_nodes $node_uuids
if is_service_enabled nova && [[ "$VIRT_DRIVER" == "ironic" ]]; then
if [[ "$HOST_TOPOLOGY_ROLE" != 'subnode' ]]; then
if [[ "$HOST_TOPOLOGY_ROLE" != "subnode" ]]; then
local adjusted_disk
adjusted_disk=$(($ironic_node_disk - $ironic_ephemeral_disk))
openstack flavor create --ephemeral $ironic_ephemeral_disk --ram $ironic_node_ram --disk $adjusted_disk --vcpus $ironic_node_cpu baremetal
@ -2598,7 +2598,7 @@ function upload_baremetal_ironic_deploy {
local ironic_deploy_ramdisk_name
ironic_deploy_kernel_name=$(basename $IRONIC_DEPLOY_KERNEL)
ironic_deploy_ramdisk_name=$(basename $IRONIC_DEPLOY_RAMDISK)
if [[ "$HOST_TOPOLOGY_ROLE" != 'subnode' ]]; then
if [[ "$HOST_TOPOLOGY_ROLE" != "subnode" ]]; then
echo_summary "Creating and uploading baremetal images for ironic"
if [ ! -e "$IRONIC_DEPLOY_RAMDISK" ] || \

View File

@ -94,7 +94,7 @@ ensure_stopped=''
# According to Ironic upgrade procedure, we shouldn't have upgraded (new) ironic-api and not upgraded (old)
# ironic-conductor. By setting redirect of API requests from primary node to subnode during upgrade
# allow to satisfy ironic upgrade requirements.
if [[ "$HOST_TOPOLOGY_ROLE" == 'primary' ]]; then
if [[ "$HOST_TOPOLOGY_ROLE" == "primary" ]]; then
disable_service ir-api
ensure_stopped+='ironic-api'
ironic_wsgi_conf=$(apache_site_config_for ironic-api-wsgi)