aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2017-05-01 13:07:20 +0000
committerGerrit Code Review <review@openstack.org>2017-05-01 13:07:20 +0000
commit5a6519f65105a8b060f1add746254d0f13db918d (patch)
tree64fe738fe4d734fccd86381553305ed438a36bb3
parent68402dc7f538418b1e0eb23bb782daf7e3bcadd4 (diff)
parentcc1a8f9987fda35244c1166db3787a851e1ff88b (diff)
Merge "Validate NTP servers"
-rw-r--r--all-nodes-validation.yaml6
-rw-r--r--validation-scripts/all-nodes.sh30
2 files changed, 36 insertions, 0 deletions
diff --git a/all-nodes-validation.yaml b/all-nodes-validation.yaml
index eea3e40..11a5b37 100644
--- a/all-nodes-validation.yaml
+++ b/all-nodes-validation.yaml
@@ -14,6 +14,10 @@ parameters:
default: false
description: Optional validation to ensure FQDN as set by Nova matches the name set in /etc/hosts.
type: boolean
+ ValidateNtp:
+ default: true
+ description: Validation to ensure at least one time source is accessible.
+ type: boolean
resources:
AllNodesValidationsImpl:
@@ -25,6 +29,8 @@ resources:
default: {get_param: PingTestIps}
- name: validate_fqdn
default: {get_param: ValidateFqdn}
+ - name: validate_ntp
+ default: {get_param: ValidateNtp}
config: {get_file: ./validation-scripts/all-nodes.sh}
outputs:
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