Skip to content

Commit 954af75

Browse files
author
Dougal Ballantyne
committed
Added DNS checks
1 parent bbdf1b6 commit 954af75

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

bootstrap/src/scripts/boot_as_compute

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ set -x
1919
# Source functions
2020
. /opt/cfncluster/scripts/functions.shlib
2121

22+
# Check DNS
23+
check_dns || error_exit "DNS checks failed."
24+
2225
# Run preinstall script if defined
2326
run_preinstall
2427

bootstrap/src/scripts/boot_as_master

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ set -x
1919
# Source functions
2020
. /opt/cfncluster/scripts/functions.shlib
2121

22+
# Check DNS
23+
check_dns || error_exit "DNS checks failed."
24+
2225
# Run preinstall script if defined
2326
run_preinstall
2427

bootstrap/src/scripts/functions.shlib

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,22 @@ function error_exit () {
1515
exit 1
1616
}
1717

18+
# Check DNS is working, as it is required for correct operation
19+
function check_dns () {
20+
TRY=0
21+
while [ $TRY -lt 3 ]; do
22+
hostname -f >/dev/null
23+
check_fqdn=$?
24+
if [ $check_fqdn -eq 0 ]; then
25+
break
26+
else
27+
sleep 10
28+
TRY=$(( $TRY + 1 ))
29+
fi
30+
done
31+
return $check_fqdn
32+
}
33+
1834
# Check and run preinstall
1935
function run_preinstall () {
2036
RC=0

0 commit comments

Comments
 (0)