Skip to content
This repository was archived by the owner on Sep 29, 2021. It is now read-only.

Commit dcfb5b2

Browse files
Merge pull request #55 from jparrill/bug/ipv6_prov_int
Allow any IPv6 address to be configured for provisioning instead of link local scope
2 parents c0f57aa + c7b8f10 commit dcfb5b2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

ironic-common.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
PROVISIONING_INTERFACE=${PROVISIONING_INTERFACE:-"provisioning"}
1+
export PROVISIONING_INTERFACE=${PROVISIONING_INTERFACE:-"provisioning"}
22

33
# Wait for the interface or IP to be up, sets $IRONIC_IP
44
function wait_for_interface_or_ip() {
55
# If $PROVISIONING_IP is specified, then we wait for that to become available on an interface, otherwise we look at $PROVISIONING_INTERFACE for an IP
66
if [ ! -z "${PROVISIONING_IP}" ];
77
then
8-
IRONIC_IP=""
8+
export IRONIC_IP=""
99
until [ ! -z "${IRONIC_IP}" ]; do
1010
echo "Waiting for ${PROVISIONING_IP} to be configured on an interface"
11-
IRONIC_IP=$(ip -br addr show | grep "${PROVISIONING_IP}" | grep -Po "[^\s]+/[0-9]+" | sed -e 's%/.*%%' | head -n 1)
11+
export IRONIC_IP=$(ip -br addr show | grep "${PROVISIONING_IP}" | grep -Po "[^\s]+/[0-9]+" | sed -e 's%/.*%%' | head -n 1)
1212
sleep 1
1313
done
1414
else
1515
until [ ! -z "${IRONIC_IP}" ]; do
1616
echo "Waiting for ${PROVISIONING_INTERFACE} interface to be configured"
17-
IRONIC_IP=$(ip -br addr show dev $PROVISIONING_INTERFACE | grep -Po "[^\s]+/[0-9]+" | grep -e "^fd" -e "\." | sed -e 's%/.*%%' | head -n 1)
17+
export IRONIC_IP=$(ip -br add show scope global up dev "${PROVISIONING_INTERFACE}" | awk '{print $3}' | sed -e 's%/.*%%' | head -n 1)
1818
sleep 1
1919
done
2020
fi
@@ -23,10 +23,10 @@ function wait_for_interface_or_ip() {
2323
# host needs surrounding with brackets
2424
if [[ "$IRONIC_IP" =~ .*:.* ]]
2525
then
26-
IPV=6
27-
IRONIC_URL_HOST="[$IRONIC_IP]"
26+
export IPV=6
27+
export IRONIC_URL_HOST="[$IRONIC_IP]"
2828
else
29-
IPV=4
30-
IRONIC_URL_HOST=$IRONIC_IP
29+
export IPV=4
30+
export IRONIC_URL_HOST=$IRONIC_IP
3131
fi
3232
}

0 commit comments

Comments
 (0)