From 52a5dd2502039a34cd6f64fc84f423588a470618 Mon Sep 17 00:00:00 2001 From: gyurix Date: Thu, 24 Nov 2022 12:56:26 +0000 Subject: [PATCH] Added validate process for getting IP address of application --- entrypoint.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 1158270..5dd234a 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -70,6 +70,15 @@ if [ ! -z "$SOURCE" ]; then for i in $(echo $SOURCE) ; do name_resolver $i; debug "source ip is $APP_IP"; + if [[ -z "$APP_IP" ]]; then + debug "No any IP address found for SOURCE: $SOURCE, try again to resolv"; + name_resolver $i; + debug "source ip is $APP_IP"; + + if [[ -z "$APP_IP" ]]; then + debug "No any IP address found for SOURCE: $SOURCE, giving up"; + fi + fi SOURCE_IP=$APP_IP; done @@ -80,6 +89,15 @@ for i in $(echo $TARGET) ; do name_resolver $i; debug "target ip is $APP_IP"; + if [[ -z "$APP_IP" ]]; then + debug "No any IP address found for TARGET: $TARGET, try again to resolv"; + name_resolver $i; + debug "Target ip is $APP_IP"; + + if [[ -z "$APP_IP" ]]; then + debug "No any IP address found for TARGET: $TARGET, giving up"; + fi + fi for IP in $(echo $APP_IP); do IDX=$(expr 1 + $IDX) eval TARGET_IP_$IDX=$IP;