Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use getent instead of nslookup for starting scripts #243

Merged
merged 1 commit into from
Aug 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docker/bin/zookeeperFunctions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ function zkConfig() {
function zkConnectionString() {
# If the client service address is not yet available, then return localhost
set +e
nslookup "${CLIENT_HOST}" 2>/dev/null 1>/dev/null
if [[ $? -eq 1 ]]; then
getent hosts "${CLIENT_HOST}" 2>/dev/null 1>/dev/null
if [[ $? -ne 0 ]]; then
set -e
echo "localhost:${CLIENT_PORT}"
else
Expand Down
4 changes: 2 additions & 2 deletions docker/bin/zookeeperReady.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ OK=$(echo ruok | nc 127.0.0.1 $CLIENT_PORT)
# Check to see if zookeeper service answers
if [[ "$OK" == "imok" ]]; then
set +e
nslookup $DOMAIN
if [[ $? -eq 1 ]]; then
getent hosts $DOMAIN
if [[ $? -ne 0 ]]; then
set -e
echo "There is no active ensemble, skipping readiness probe..."
exit 0
Expand Down
6 changes: 3 additions & 3 deletions docker/bin/zookeeperStart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ if [[ -n "$ENVOY_SIDECAR_STATUS" ]]; then
fi
set -e

# Determine if there is a ensemble available to join by checking the service domain
# Determine if there is an ensemble available to join by checking the service domain
set +e
nslookup $DOMAIN
getent hosts $DOMAIN # This only performs a dns lookup
if [[ $? -eq 0 ]]; then
ACTIVE_ENSEMBLE=true
elif nslookup $DOMAIN | grep -q "server can't find $DOMAIN"; then
Expand All @@ -87,7 +87,7 @@ else
do
sleep 2
((count=count-1))
nslookup $DOMAIN
getent hosts $DOMAIN
if [[ $? -eq 0 ]]; then
ACTIVE_ENSEMBLE=true
break
Expand Down