Skip to content

Commit 4b626bc

Browse files
committed
Make IRONIC_IP higher priority than PROVISIONING_IP
Up to now wait_for_interface_or_ip has parse the values in the following order: PROVISIONING_IP, IRONIC_IP, PROVISIONING_INTERFACE. However IRONIC_IP should likely be considered as overriding any PROVISIONING_* value. Thus, make sure IRONIC_IP is evaluated at the beginning of the chain. Signed-off-by: Marco Chiappero <[email protected]>
1 parent f09ca4c commit 4b626bc

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

scripts/ironic-common.sh

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,19 @@ parse_ip_address()
111111
# Wait for the interface or IP to be up, sets $IRONIC_IP
112112
wait_for_interface_or_ip()
113113
{
114-
# If $PROVISIONING_IP is specified, then we wait for that to become
115-
# available on an interface, otherwise we look at $PROVISIONING_INTERFACE
116-
# for an IP
117-
if [[ -n "${PROVISIONING_IP}" ]]; then
114+
# IRONIC_IP already defined overrides everything else
115+
if [[ -n "${IRONIC_IP}" ]]; then
116+
local PARSED_IP
117+
PARSED_IP="$(parse_ip_address "${IRONIC_IP}")"
118+
if [[ -z "${PARSED_IP}" ]]; then
119+
return 1
120+
fi
121+
122+
export IRONIC_IP="${PARSED_IP}"
123+
elif [[ -n "${PROVISIONING_IP}" ]]; then
124+
# If $PROVISIONING_IP is specified, then we wait for that to become
125+
# available on an interface, otherwise we look at $PROVISIONING_INTERFACE
126+
# for an IP
118127
local PARSED_IP
119128
PARSED_IP="$(parse_ip_address "${PROVISIONING_IP}")"
120129
if [[ -z "${IRONIC_IP}" ]]; then
@@ -131,14 +140,6 @@ wait_for_interface_or_ip()
131140
echo "Found ${PROVISIONING_IP} on interface \"${IFACE_OF_IP}\"!"
132141

133142
export PROVISIONING_INTERFACE="${IFACE_OF_IP}"
134-
export IRONIC_IP="${PARSED_IP}"
135-
elif [[ -n "${IRONIC_IP}" ]]; then
136-
local PARSED_IP
137-
PARSED_IP="$(parse_ip_address "${IRONIC_IP}")"
138-
if [[ -z "${PARSED_IP}" ]]; then
139-
return 1
140-
fi
141-
142143
export IRONIC_IP="${PARSED_IP}"
143144
elif [[ -n "${PROVISIONING_INTERFACE}" ]]; then
144145
until [[ -n "$IRONIC_IP" ]]; do

0 commit comments

Comments
 (0)