diff --git a/src/manager/om/script/gs_checkos b/src/manager/om/script/gs_checkos index 6002c42c8..0cf1e70e1 100644 --- a/src/manager/om/script/gs_checkos +++ b/src/manager/om/script/gs_checkos @@ -426,7 +426,6 @@ def doCheckOS(itemNumber): """ if (itemNumber == 'A1'): checkOSVersion() - checkOSConfig() elif (itemNumber == 'A2'): checkKernelVersion() elif (itemNumber == 'A3'): @@ -1408,27 +1407,6 @@ def getTmpFile(): else: return tmpFile - -def checkOSConfig(): - ''' - function : Check the parameters in logind.conf - ''' - g_logger.debug("Checking OS configuration.") - try: - cmd = "cat /etc/systemd/logind.conf | " + \ - "grep RemoveIPC | grep -o -E '(yes|no)' | tail -1" - (status, output, outputMap) = getCmdOutput(cmd) - for hostName in outputMap: - result = outputMap[hostName] - if (result.strip() == "yes"): - g_logger.logExit("[%s]: \n" % hostName + - ErrorCode.GAUSS_516["GAUSS_51632"] % cmd + - " Error: \n You should set RemoveIPC=no " + \ - "in /etc/systemd/logind.conf, "+ \ - "and restart the server") - except Exception as e: - g_logger.debug(str(e)) - g_logger.debug("Successfully checked OS config.") def main(): """ main function diff --git a/src/manager/om/script/local/LocalCheckOS.py b/src/manager/om/script/local/LocalCheckOS.py index d1880bf24..c855ea0f2 100644 --- a/src/manager/om/script/local/LocalCheckOS.py +++ b/src/manager/om/script/local/LocalCheckOS.py @@ -798,27 +798,26 @@ def disRemoveIPC(): """ g_logger.debug("disbale RemoveIPC.") distName = g_Platform.getCurrentPlatForm()[0] - if distName.upper() == "OPENEULER": + if distName.upper() in ("OPENEULER", "KYLIN"): cmd = "setenforce 0" subprocess.getstatusoutput(cmd) initFile = "/usr/lib/systemd/system/systemd-logind.service" if os.path.exists(initFile): - # 1.close thp - close_cmd = """(if [ `systemctl show systemd-logind | - grep RemoveIPC` != "RemoveIPC=no" ]; - then echo 'RemoveIPC=no' >> /usr/lib/systemd - /system/systemd-logind.service; - sed -i '/RemoveIPC=yes/'d - /usr/lib/systemd/system/systemd-logind.service;fi;)""" + close_cmd = "if [ `systemctl show systemd-logind | " \ + "grep RemoveIPC` != \"RemoveIPC=no\" ]; " \ + "then echo 'RemoveIPC=no' >> " \ + "/usr/lib/systemd/system/systemd-logind.service; " \ + "sed -i '/RemoveIPC=yes/'d " \ + "/usr/lib/systemd/system/systemd-logind.service; fi;" disableRemoveIPCLog(close_cmd) initFile = "/etc/systemd/logind.conf" if os.path.exists(initFile): - close_cmd = """(if [ `loginctl show-session | grep RemoveIPC` - != "RemoveIPC=no" ]; - then - echo 'RemoveIPC=no' >> /etc/systemd/logind.conf; - sed -i '/RemoveIPC=yes/'d /etc/systemd/logind.conf; - fi;)""" + close_cmd = "if [ `loginctl show-session | " \ + "grep RemoveIPC` != \"RemoveIPC=no\" ]; " \ + "then echo 'RemoveIPC=no' >> " \ + "/etc/systemd/logind.conf; " \ + "sed -i '/RemoveIPC=yes/'d " \ + "/etc/systemd/logind.conf; fi;" disableRemoveIPCLog(close_cmd) cmd = "systemctl daemon-reload" disableRemoveIPCLog(cmd)