Compare commits
10 Commits
c508493bd6
...
39cc72476a
Author | SHA256 | Date | |
---|---|---|---|
39cc72476a
|
|||
e58b9de61c
|
|||
65f482ea85
|
|||
21270fdb09
|
|||
8449a9cb3f
|
|||
ddcd99f38c
|
|||
341c04f2eb
|
|||
c9eadad2a7
|
|||
1cb85293e1
|
|||
ff29574a35
|
@@ -122,8 +122,6 @@ get_provisioning_interface()
|
||||
return
|
||||
fi
|
||||
|
||||
local interface="provisioning"
|
||||
|
||||
for mac in ${PROVISIONING_MACS//,/ }; do
|
||||
if ip -br link show up | grep -i "$mac" &>/dev/null; then
|
||||
interface="$(ip -br link show up | grep -i "$mac" | cut -f 1 -d ' ' | cut -f 1 -d '@')"
|
||||
@@ -146,33 +144,48 @@ wait_for_interface_or_ip()
|
||||
# available on an interface, otherwise we look at $PROVISIONING_INTERFACE
|
||||
# for an IP
|
||||
if [[ -n "${PROVISIONING_IP}" ]]; then
|
||||
echo "${FUNCNAME}: Lookup by PROVISIONING_IP"
|
||||
local IFACE_OF_IP=""
|
||||
|
||||
until [[ -z $IFACE_OF_IP ]]; do
|
||||
echo "Waiting for ${PROVISIONING_IP} to be configured on an interface"
|
||||
until [[ -n "$IFACE_OF_IP" ]]; do
|
||||
echo "Waiting for ${PROVISIONING_IP} to be configured on an interface..."
|
||||
IFACE_OF_IP="$(get_interface_of_ip $PROVISIONING_IP)"
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# Add some debugging output
|
||||
echo "Found $PROVISIONING_IP on interface $IFACE_OF_IP"
|
||||
echo "Found $PROVISIONING_IP on interface \"${IFACE_OF_IP}\"!"
|
||||
|
||||
export PROVISIONING_INTERFACE="$IFACE_OF_IP"
|
||||
# If the IP contains a colon, then it's an IPv6 address
|
||||
# If the IP contains a colon, then it's an IPv6 address
|
||||
if [[ "$PROVISIONING_IP" =~ .*:.* ]]; then
|
||||
export IRONIC_IPV6="$PROVISIONING_IP"
|
||||
else
|
||||
export IRONIC_IP="$PROVISIONING_IP"
|
||||
fi
|
||||
elif [[ -n "${PROVISIONING_INTERFACE}" ]]; then
|
||||
until [[ -n "$IRONIC_IPV6" ]] || [[ -n "$IRONIC_IP" ]]; do
|
||||
echo "Waiting for ${PROVISIONING_INTERFACE} interface to be configured..."
|
||||
|
||||
export IRONIC_IPV6="$(get_ip_of_interface $PROVISIONING_INTERFACE 6)"
|
||||
sleep 1
|
||||
|
||||
export IRONIC_IP="$(get_ip_of_interface $PROVISIONING_INTERFACE 4)"
|
||||
sleep 1
|
||||
done
|
||||
|
||||
if [[ -n "$IRONIC_IPV6" ]]; then
|
||||
echo "Found $IRONIC_IPV6 on interface \"${PROVISIONING_INTERFACE}\"!"
|
||||
fi
|
||||
if [[ -n "$IRONIC_IP" ]]; then
|
||||
echo "Found $IRONIC_IP on interface \"${PROVISIONING_INTERFACE}\"!"
|
||||
fi
|
||||
elif [[ -n "$IRONIC_URL_HOSTNAME" ]]; then
|
||||
echo "${FUNCNAME}: Lookup by IRONIC_URL_HOSTNAME"
|
||||
local IPV6_IFACE=""
|
||||
local IPV4_IFACE=""
|
||||
|
||||
# we should get at least one IP address
|
||||
until [[ -z "$IFACE_IPV6" ]] && [[ -z "$IFACE_IPV4" ]]; do
|
||||
while [[ -z "$IPV6_IFACE" ]] && [[ -z "$IPV4_IFACE" ]]; do
|
||||
local IPV6_RECORD=""
|
||||
local IPV4_RECORD=""
|
||||
local IPV6_IFACE=""
|
||||
local IPV4_IFACE=""
|
||||
local IPV4_RECORD=""
|
||||
|
||||
IPV6_RECORD="$(get_ip_of_hostname $IRONIC_URL_HOSTNAME 6)"
|
||||
IPV4_RECORD="$(get_ip_of_hostname $IRONIC_URL_HOSTNAME 4)"
|
||||
@@ -194,10 +207,10 @@ wait_for_interface_or_ip()
|
||||
|
||||
# Add some debugging output
|
||||
if [[ -n "$IPV6_IFACE" ]]; then
|
||||
echo "Found $IPV6_RECORD on interface $IPV6_IFACE"
|
||||
echo "Found $IPV6_RECORD on interface \"${IPV6_IFACE}\"!"
|
||||
fi
|
||||
if [[ -n "$IPV4_IFACE" ]]; then
|
||||
echo "Found $IPV4_RECORD on interface $IPV4_IFACE"
|
||||
echo "Found $IPV4_RECORD on interface \"${IPV4_IFACE}\"!"
|
||||
fi
|
||||
|
||||
# Make sure both IPs are asigned to the same interface
|
||||
@@ -208,25 +221,6 @@ wait_for_interface_or_ip()
|
||||
|
||||
export IRONIC_IP="$IPV4_RECORD"
|
||||
export IRONIC_IPV6="$IPV6_RECORD"
|
||||
elif [[ -n "${PROVISIONING_INTERFACE}" ]]; then
|
||||
echo "${FUNCNAME}: Lookup by PROVISIONING_INTERFACE"
|
||||
until [[ -z "$IRONIC_IPV6" ]] && [[ -z "$IRONIC_IP" ]]; do
|
||||
echo "Waiting for ${PROVISIONING_INTERFACE} interface to be configured"
|
||||
|
||||
export IRONIC_IPV6="$(get_ip_of_interface $PROVISIONING_INTERFACE 6)"
|
||||
sleep 1
|
||||
|
||||
export IRONIC_IP="$(get_ip_of_interface $PROVISIONING_INTERFACE 4)"
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# Add some debugging output
|
||||
if [[ -n "$IRONIC_IPV6" ]]; then
|
||||
echo "Found $IRONIC_IPV6 on interface $PROVISIONING_INTERFACE"
|
||||
fi
|
||||
if [[ -n "$IRONIC_IP" ]]; then
|
||||
echo "Found $IRONIC_IP on interface $PROVISIONING_INTERFACE"
|
||||
fi
|
||||
else
|
||||
echo "Cannot determine an interface or an IP for binding and creating URLs"
|
||||
return 1
|
||||
@@ -243,8 +237,6 @@ wait_for_interface_or_ip()
|
||||
export IRONIC_URL_HOST="[$IRONIC_IPV6]" # The HTTP host needs surrounding with brackets
|
||||
fi
|
||||
|
||||
echo "IRONIC_IP=${IRONIC_IP} - IRONIC_IPV6=${IRONIC_IPV6}"
|
||||
|
||||
# Once determined if we have IPv4 and/or IPv6, override the hostname if provided
|
||||
if [[ -n "$IRONIC_URL_HOSTNAME" ]]; then
|
||||
IRONIC_URL_HOST=$IRONIC_URL_HOSTNAME
|
||||
|
Reference in New Issue
Block a user