From e0f6f9838f2c8376d9091c9c45e2cc5658f042b6 Mon Sep 17 00:00:00 2001 From: Alex Schultz Date: Tue, 4 Sep 2018 14:04:22 -0600 Subject: [PATCH] Add chrony support to validations If ntpdate is not available, use chrony as that is a default package shipped since CentOS7. Change-Id: I6155508b491623de1370b9e78907bc36523409b5 Related-Blueprint: tripleo-chrony --- validation-scripts/all-nodes.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/validation-scripts/all-nodes.sh b/validation-scripts/all-nodes.sh index 92d4a47800..0b0c420382 100644 --- a/validation-scripts/all-nodes.sh +++ b/validation-scripts/all-nodes.sh @@ -83,6 +83,16 @@ function fqdn_check() { echo "SUCCESS" } +# run chrony/ntpdate as available +function _run_ntp_sync() { + local NTP_SERVER=$1 + if ! type ntpdate 2>/dev/null; then + chronyd -Q "server $NTP_SERVER iburst" + else + ntpdate -qud $NTP_SERVER + fi +} + # Verify at least one time source is available. function ntp_check() { NTP_SERVERS=$(hiera ntp::servers nil |tr -d '[],"') @@ -91,7 +101,7 @@ function ntp_check() { NTP_SUCCESS=0 for NTP_SERVER in $NTP_SERVERS; do set +e - NTPDATE_OUT=$(ntpdate -qud $NTP_SERVER 2>&1) + NTPDATE_OUT=$(_run_ntp_sync $NTP_SERVER 2>&1) NTPDATE_EXIT=$? set -e if [[ "$NTPDATE_EXIT" == "0" ]];then