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