!449 修改CheckEtcHosts检查逻辑

Merge pull request !449 from liuheng/master
This commit is contained in:
opengauss-bot 2023-04-13 12:34:41 +00:00 committed by Gitee
commit 6cd98ea738
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -68,18 +68,10 @@ class CheckEtcHosts(BaseItem):
flag = "Error_conflicts"
else:
IPMapping[ip] = host
if (len(IPInfo.split()) > 2 and IPInfo.split()[2] == "#Gauss"):
commentsMapping.append(IPInfo + " IP Hosts Mapping")
flag = "Error_comments"
if (flag == "Normal"):
self.result.rst = ResultStatus.OK
self.result.val = "The /etc/hosts is configured correctly."
elif (flag == "Error_comments"):
self.result.rst = ResultStatus.NG
self.result.val = "The /etc/hosts has comments Mapping:\n" \
+ "\n".join(
commentsMapping)
else:
self.result.rst = ResultStatus.NG
self.result.val = "The /etc/hosts has conflicts Mapping:\n" \