mirror of
https://github.com/xcat2/xcat-core.git
synced 2026-09-04 20:17:55 +00:00
fix(setupntp): --backend ntpd configures a daemon that is not installed
setupntp falls back from chrony to ntpd when chronyd is absent, but not the other way. A node told --backend ntpd, or --use-ntpd, that has only chrony execs setupntp.traditional, which writes /etc/ntp.conf and calls startservice ntpserver for a daemon that is not there. The node ends with no running time daemon and a warning in the log. The ntpd branch of the backend selection now probes ntpd. When ntpd is absent and chronyd and systemctl are both present, setupntp uses chrony and logs the change, the same way the chrony branch already does. makentp_ntp_deps.t covers both directions. The two ntpd cases fail without this change. Signed-off-by: Daniel Hilst <392820+dhilst@users.noreply.github.com>
This commit is contained in:
@@ -139,11 +139,19 @@ then
|
||||
esac
|
||||
fi
|
||||
|
||||
# The requested backend is a preference, not a guarantee: a node that does not have chronyd
|
||||
# still has to be configured, so fall back to ntpd and say so rather than failing.
|
||||
# The requested backend is a preference, not a guarantee: a node that does not have the
|
||||
# requested daemon still has to be configured, so use the other one and say so.
|
||||
if [ "${NTP_BACKEND}" = "ntpd" ]
|
||||
then
|
||||
USE_NTPD="yes"
|
||||
if ! check_executes ntpd >/dev/null 2>&1 &&
|
||||
check_executes chronyd >/dev/null 2>&1 &&
|
||||
check_executes systemctl >/dev/null 2>&1
|
||||
then
|
||||
USE_NTPD=""
|
||||
logger -t $log_label -p local4.warning \
|
||||
"setupntp: ntpd requested but ntpd is absent; using chrony"
|
||||
fi
|
||||
else
|
||||
check_executes chronyd >/dev/null 2>&1 || USE_NTPD="yes"
|
||||
check_executes systemctl >/dev/null 2>&1 || USE_NTPD="yes"
|
||||
|
||||
Reference in New Issue
Block a user