Add support to ping IPv6 metadata IP

Change-Id: Ifc5d690da7e01b3b710eae80d0f6f9f6822b48fa
Closes-Bug: #1757110
(cherry picked from commit 1dd29b3daf)
This commit is contained in:
Derek Higgins 2018-03-20 11:29:25 +00:00 committed by Bogdan Dobrelya
parent 3bc041b47d
commit bb9592fd3e
1 changed files with 7 additions and 2 deletions

View File

@ -19,7 +19,7 @@ function get_metadata_ip() {
# Look for a variety of Heat transports
# FIXME: Heat should provide a way to obtain this in a single place
for URL in os-collect-config.cfn.metadata_url os-collect-config.heat.auth_url os-collect-config.request.metadata_url os-collect-config.zaqar.auth_url; do
METADATA_IP=$(os-apply-config --key $URL --key-default '' --type raw 2>/dev/null | sed -e 's|http.*://\([^:]*\).*|\1|')
METADATA_IP=$(os-apply-config --key $URL --key-default '' --type raw 2>/dev/null | sed -e 's|http.*://\[\?\([^]]*\)]\?:.*|\1|')
[ -n "$METADATA_IP" ] && break
done
@ -43,8 +43,13 @@ function ping_metadata_ip() {
echo -n "Trying to ping metadata IP ${METADATA_IP}..."
_ping=ping
if [[ "$METADATA_IP" =~ ":" ]] ; then
_ping=ping6
fi
local COUNT=0
until ping -c 1 $METADATA_IP &> /dev/null; do
until $_ping -c 1 $METADATA_IP &> /dev/null; do
COUNT=$(( $COUNT + 1 ))
if [ $COUNT -eq 10 ]; then
echo "FAILURE"