[bitnami/elasticsearch] Fix get_machine_ip to handle IPv6 addresses (#67083)
* Fix get_machine_ip to handle IPv6 addresses Signed-off-by: Reddysekhar Gaduputi <gsekhar73@gmail.com> * Fix get_machine_ip to handle IPv6 addresses Signed-off-by: Reddysekhar Gaduputi <gsekhar73@gmail.com> --------- Signed-off-by: Reddysekhar Gaduputi <gsekhar73@gmail.com>
This commit is contained in:
parent
a7e3b8cbaf
commit
04f785d868
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
# Load Generic Libraries
|
||||
. /opt/bitnami/scripts/liblog.sh
|
||||
. /opt/bitnami/scripts/libvalidations.sh
|
||||
|
||||
# Functions
|
||||
|
||||
|
|
@ -68,7 +69,13 @@ get_machine_ip() {
|
|||
error "Could not find any IP address associated to hostname ${hostname}"
|
||||
exit 1
|
||||
fi
|
||||
echo "${ip_addresses[0]}"
|
||||
|
||||
# Check if the first IP address is IPv6 and add brackets
|
||||
if validate_ipv6 "${ip_addresses[0]}" ; then
|
||||
echo "[${ip_addresses[0]}]"
|
||||
else
|
||||
echo "${ip_addresses[0]}"
|
||||
fi
|
||||
}
|
||||
|
||||
########################
|
||||
|
|
|
|||
Loading…
Reference in New Issue