Warn if hardware clock sync fails

This commit is contained in:
Daniel A. Wozniak 2025-01-25 23:59:35 -07:00 committed by Daniel Wozniak
parent 9cb51fac91
commit 511164e10b

View file

@ -12,6 +12,7 @@ Support for reboot, shutdown, etc on POSIX-like systems.
"""
import logging
import os.path
import re
from datetime import datetime, timedelta, tzinfo
@ -22,6 +23,8 @@ import salt.utils.platform
from salt.exceptions import CommandExecutionError, SaltInvocationError
from salt.utils.decorators import depends
log = logging.getLogger(__name__)
__virtualname__ = "system"
@ -202,10 +205,10 @@ def _swclock_to_hwclock():
"""
res = __salt__["cmd.run_all"](["hwclock", "--systohc"], python_shell=False)
if res["retcode"] != 0:
msg = "hwclock failed to set hardware clock from software clock: {}".format(
res["stderr"]
log.warn(
"hwclock failed to set hardware clock from software clock: %s",
res["stderr"],
)
raise CommandExecutionError(msg)
return True