Skip to content

Commit

Permalink
(maint) Exit Docker wait script properly
Browse files Browse the repository at this point in the history
 - Running `dig` always yields a non-zero exit code. Capture the exit
   status of the wtfc.sh helper script when querying the name with host
   which yields a non-zero exit code on failure.

   This ensures that initial lookups fail the entrypoint script as
   desired, rather than continuing on
  • Loading branch information
Iristyle committed Oct 28, 2019
1 parent ec71111 commit e99fc05
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docker/puppetdb/docker-entrypoint.d/20-wait-for-hosts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ wait_for_host_name_resolution() {
# k8s nodes may not be reachable with a ping
/wtfc.sh --timeout=$PUPPETDB_WAITFORHOST_SECONDS --interval=1 --progress host $1
# additionally log the DNS lookup information for diagnostic purposes
NAME_RESOLVED=$?
dig $1
if [ $? -ne 0 ]; then
if [ $NAME_RESOLVED -ne 0 ]; then
error "dependent service at $1 cannot be resolved or contacted"
fi
}
Expand Down

0 comments on commit e99fc05

Please sign in to comment.