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
This commit is contained in:
parent
224383fa35
commit
e0f6f9838f
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user