Merge "Add chrony support to validations"

This commit is contained in:
Zuul 2018-09-13 01:33:58 +00:00 committed by Gerrit Code Review
commit 2c73ce5bb9

View File

@ -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