diff --git a/sysinv/sysinv-fpga-agent/run_docker_login b/sysinv/sysinv-fpga-agent/run_docker_login index 4824f44a8d..08a828a151 100644 --- a/sysinv/sysinv-fpga-agent/run_docker_login +++ b/sysinv/sysinv-fpga-agent/run_docker_login @@ -21,10 +21,14 @@ function LOG { LOG "Waiting for registry.local to resolve" while true do - # This will ask for both A and AAAA records to handle IPv4 and IPv6. - # We don't want to do an ANY request because some DNS servers reject - # them and they can return way more data than we actually want. - ADDR=`dig +short registry.local A registry.local AAAA` + # We can't easily ask for both A and AAAA records in the same request + # because if the customer mis-configures things with a "good" nameserver + # and a non-existant nameserver dig will return "9" even though it finds + # an AAAA record on the "good" server. So we need to ask for A and AAAA + # records separately. Once we have either type of record we can proceed. + + # First check for A records for IPv4 + ADDR=`dig +short registry.local A` if [ $? -eq 0 ] then # We got a response back from the server, but we need to check @@ -32,10 +36,25 @@ do # be an empty string. if [ -n "$ADDR" ] then - echo LOG "registry.local resolved, continuing with docker login" + echo LOG "registry.local resolved IPv4, continuing with docker login" break fi fi + + # Then check for AAAA records for IPv6 + ADDR=`dig +short registry.local AAAA` + if [ $? -eq 0 ] + then + # We got a response back from the server, but we need to check + # if we got an address or not. If there is no address, ADDR will + # be an empty string. + if [ -n "$ADDR" ] + then + echo LOG "registry.local resolved IPv6, continuing with docker login" + break + fi + fi + sleep 1 done