aboutsummaryrefslogtreecommitdiffstats
path: root/validation-scripts/all-nodes.sh
diff options
context:
space:
mode:
authorMatthew Flusche <mflusche@redhat.com>2017-04-13 19:30:56 +0000
committerMatthew Flusche <mflusche@redhat.com>2017-04-13 19:54:56 +0000
commitcc1a8f9987fda35244c1166db3787a851e1ff88b (patch)
tree6d5404d65fe11aab93575566b645f5e6e7b02301 /validation-scripts/all-nodes.sh
parent8391468d16d9c16a91c7b569789402fdcbda6753 (diff)
Validate NTP servers
Adds a validation to ensure at least one NTP source is available. Misconfigured or inaccessible NTP servers is a common source of erratic behavior and failures. This validation will ensure a NTP source is available or fail with debug output from ntpdate. The heat boolean: ValidateNtp can be set to disable this check. Change-Id: Ie93f943b53bf3a1b60a536df4a28ae203d98988f
Diffstat (limited to 'validation-scripts/all-nodes.sh')
-rw-r--r--validation-scripts/all-nodes.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/validation-scripts/all-nodes.sh b/validation-scripts/all-nodes.sh
index f1f4cc1..ed7fefb 100644
--- a/validation-scripts/all-nodes.sh
+++ b/validation-scripts/all-nodes.sh
@@ -82,8 +82,38 @@ function fqdn_check() {
echo "SUCCESS"
}
+# Verify at least one time source is available.
+function ntp_check() {
+ NTP_SERVERS=$(hiera ntp::servers nil |tr -d '[],"')
+ if [[ "$NTP_SERVERS" != "nil" ]];then
+ echo -n "Testing NTP..."
+ NTP_SUCCESS=0
+ for NTP_SERVER in $NTP_SERVERS; do
+ set +e
+ NTPDATE_OUT=$(ntpdate -qud $NTP_SERVER 2>&1)
+ NTPDATE_EXIT=$?
+ set -e
+ if [[ "$NTPDATE_EXIT" == "0" ]];then
+ NTP_SUCCESS=1
+ break
+ else
+ NTPDATE_OUT_FULL="$NTPDATE_OUT_FULL $NTPDATE_OUT"
+ fi
+ done
+ if [[ "$NTP_SUCCESS" == "0" ]];then
+ echo "FAILURE"
+ echo "$NTPDATE_OUT_FULL"
+ exit 1
+ fi
+ echo "SUCCESS"
+ fi
+}
+
ping_controller_ips "$ping_test_ips"
ping_default_gateways
if [[ $validate_fqdn == "True" ]];then
fqdn_check
fi
+if [[ $validate_ntp == "True" ]];then
+ ntp_check
+fi