gs_checkos时间一致性检查修复

This commit is contained in:
axiaxixixixi 2024-09-26 10:08:14 +08:00
parent 05966d11ac
commit 2abc2dd470
2 changed files with 2 additions and 7 deletions

View File

@ -1002,7 +1002,7 @@ def checkTimeConsistency():
and (outputMap[node].strip().split(',')[0].strip()
== str(False))):
g_OSCheckOpts['A12'][2] = 'Warning'
parRes += " [%s]\n The NTPD not detected" \
parRes += " [%s]\n Neither nptd nor chrony was detected" \
" on machine and local time is \"%s\".\n"\
% (node,
outputMap[node].strip().split(',')[1].strip())
@ -1044,7 +1044,7 @@ def checkTimeConsistency():
else:
nodeValue = list(status.keys())[0].strip()
keystr = outputMap[nodeValue].strip().split(',')[1].strip()
g_OSCheckOpts['A12'][3] = "\n The ntpd service is " \
g_OSCheckOpts['A12'][3] = "\n The ntpd or chronyd service is " \
"started, local time is \"%s\"." % keystr
g_OSCheckOpts['A12'][4] = "\n%s" % detail_msg

View File

@ -1507,15 +1507,10 @@ def collectNtpd():
result = p.communicate()
if p.returncode != 0: # No ntpd process found
g_logger.warn("No ntpd process found, "
"try to execute chrony.")
p = subprocess.Popen(["pgrep", "chronyd"], shell=False,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
result = p.communicate()
if p.returncode != 0: # No chrony process found
g_logger.error("The system time synchronization process is not found. "
"Please check whether ntpd or chrony is installed in the system")
if data.errormsg:
data.errormsg = "%s\n%s" % (data.errormsg, result[1].strip())