Fix boolean style typos for define-vm scripts
Also fix some other typos.
Change-Id: Iae4a49c90d53c152d54b6fadbdc66a04e837ce71
Related-Prod: PROD-28144 (PROD:28144)
diff --git a/predefine-vm/define-vm-vbox.sh b/predefine-vm/define-vm-vbox.sh
index 1e2dab8..277b940 100755
--- a/predefine-vm/define-vm-vbox.sh
+++ b/predefine-vm/define-vm-vbox.sh
@@ -20,7 +20,7 @@
if [[ $? -ne 0 ]]; then
vboxmanage hostonlyif create
else
- if [[ ! ${AUTO_USER_CONFIRM} ]]; then
+ if [[ "${AUTO_USER_CONFIRM}" =~ [Ff]alse ]]; then
echo "Hosted-network ${CONTROL_NET_NAME} already exists, shall we override it? Type 'yes' to confirm or anything else to skip."
read manageControlNet
fi
@@ -36,12 +36,12 @@
if [[ $? -ne 0 ]]; then
vboxmanage natnetwork add --netname "${DEPLOY_NET_NAME}" --network "${DEPLOY_NETWORK}" --enable --dhcp off
else
- if [[ ! ${AUTO_USER_CONFIRM} ]]; then
+ if [[ "${AUTO_USER_CONFIRM}" =~ [Ff]alse ]]; then
echo "Nat network ${DEPLOY_NET_NAME} already exists, shall we override it? Type 'yes' to confirm or anything else to skip."
read manageDeployNet
fi
if [[ "${manageDeployNet}" == 'yes' ]]; then
- vboxmanage natnetwork modify --netname "${DEPLOY_NET_NAME}" --network "${natNetwork}/${natCIDR}" --enable --dhcp off
+ vboxmanage natnetwork modify --netname "${DEPLOY_NET_NAME}" --network "${DEPLOY_NETWORK}" --enable --dhcp off
fi
fi
}
@@ -70,7 +70,7 @@
if [[ -d "${openstackConfig}" ]]; then
local networkConfigOpenstack="${openstackConfig}/network_data.json"
local ens="[{'ethernet_mac_address': '${mac1}', 'type': 'phy', 'id': 'ens3', 'name': 'ens3'}, {'ethernet_mac_address': '${mac2}', 'type': 'phy', 'id': 'ens4', 'name': 'ens4'}]"
- python -c "import json; networkData=json.load(open('${networkConfigOpenstack}', 'r')); networkData['links']=${ens4}; json.dump(networkData, open('${networkConfigOpenstack}', 'w'))"
+ python -c "import json; networkData=json.load(open('${networkConfigOpenstack}', 'r')); networkData['links']=${ens}; json.dump(networkData, open('${networkConfigOpenstack}', 'w'))"
iso_label='config-2'
else
local networkConfigV2Template="""
@@ -125,7 +125,7 @@
macaddress1=$(vboxmanage showvminfo "${VM_NAME}" --details --machinereadable | grep macaddress1 | cut -f 2 -d '=' | tr -d '"' | sed 's/../&:/g; s/:$//')
macaddress2=$(vboxmanage showvminfo "${VM_NAME}" --details --machinereadable | grep macaddress2 | cut -f 2 -d '=' | tr -d '"' | sed 's/../&:/g; s/:$//')
- [[ ${UPDATE_ISO_INTERFACES} ]] && update_iso ${macaddress1} ${macaddress2}
+ [[ "${UPDATE_ISO_INTERFACES}" =~ [Tt]rue ]] && update_iso ${macaddress1} ${macaddress2}
vboxmanage storageattach "${VM_NAME}" \
--storagectl "IDE" --port 0 --device 0 \
diff --git a/predefine-vm/define-vm.sh b/predefine-vm/define-vm.sh
index 17f21c7..93f05a5 100755
--- a/predefine-vm/define-vm.sh
+++ b/predefine-vm/define-vm.sh
@@ -67,7 +67,7 @@
<bridge name="${network}" />
<ip address="${gateway}" netmask="${netmask}"/>
EOF
- if [[ ${nat} ]]; then
+ if [[ "${nat}" =~ [Tt]rue ]]; then
cat <<EOF>> $(pwd)/${network}.xml
<forward mode="nat"/>
EOF
@@ -123,7 +123,7 @@
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
EOF
-if [[ ! ${VM_MGM_BRIDGE_DISABLE} ]]; then
+if [[ "${VM_MGM_BRIDGE_DISABLE}" =~ [Ff]alse ]]; then
create_bridge_network "${VM_MGM_NETWORK_NAME}" "${VM_MGM_BRIDGE_NAME}"
cat <<EOF >> $(pwd)/${VM_NAME}-vm.xml
<interface type='bridge'>
@@ -143,7 +143,7 @@
EOF
fi
-if [[ ! ${VM_CTL_BRIDGE_DISABLE} ]]; then
+if [[ "${VM_MGM_BRIDGE_DISABLE}" =~ [Ff]alse ]]; then
create_bridge_network "${VM_CTL_NETWORK_NAME}" "${VM_CTL_BRIDGE_NAME}"
cat <<EOF >> $(pwd)/${VM_NAME}-vm.xml
<interface type='bridge'>