Skip to content

Commit a3971ce

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 bd05dc0 commit a3971ce

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

scripts/ironic-common.sh

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,20 @@ parse_ip_address()
114114
# Wait for the interface or IP to be up, sets $IRONIC_IP
115115
wait_for_interface_or_ip()
116116
{
117-
# If $PROVISIONING_IP is specified, then we wait for that to become
118-
# available on an interface, otherwise we look at $PROVISIONING_INTERFACE
119-
# for an IP
120-
if [[ -n "${PROVISIONING_IP}" ]]; then
117+
# IRONIC_IP already defined overrides everything else
118+
if [[ -n "${IRONIC_IP}" ]]; then
119+
local PARSED_IP
120+
PARSED_IP="$(parse_ip_address "${IRONIC_IP}")"
121+
if [[ -z "${PARSED_IP}" ]]; then
122+
echo "ERROR: PROVISIONING_IP contains an invalid IP address, failed to start ironic"
123+
exit 1
124+
fi
125+
126+
export IRONIC_IP="${PARSED_IP}"
127+
elif [[ -n "${PROVISIONING_IP}" ]]; then
128+
# If $PROVISIONING_IP is specified, then we wait for that to become
129+
# available on an interface, otherwise we look at $PROVISIONING_INTERFACE
130+
# for an IP
121131
local PARSED_IP
122132
PARSED_IP="$(parse_ip_address "${PROVISIONING_IP}")"
123133
if [[ -z "${PARSED_IP}" ]]; then
@@ -135,15 +145,6 @@ wait_for_interface_or_ip()
135145
echo "Found ${PROVISIONING_IP} on interface \"${IFACE_OF_IP}\"!"
136146

137147
export PROVISIONING_INTERFACE="${IFACE_OF_IP}"
138-
export IRONIC_IP="${PARSED_IP}"
139-
elif [[ -n "${IRONIC_IP}" ]]; then
140-
local PARSED_IP
141-
PARSED_IP="$(parse_ip_address "${IRONIC_IP}")"
142-
if [[ -z "${PARSED_IP}" ]]; then
143-
echo "ERROR: PROVISIONING_IP contains an invalid IP address, failed to start ironic"
144-
exit 1
145-
fi
146-
147148
export IRONIC_IP="${PARSED_IP}"
148149
elif [[ -n "${PROVISIONING_INTERFACE}" ]]; then
149150
until [[ -n "$IRONIC_IP" ]]; do

0 commit comments

Comments
 (0)