diff --git a/dockerManager/dockerInstall.py b/dockerManager/dockerInstall.py index a43e6dbba..215174404 100755 --- a/dockerManager/dockerInstall.py +++ b/dockerManager/dockerInstall.py @@ -10,7 +10,7 @@ import time class DockerInstall: @staticmethod - def submitInstallDocker(): + def submitInstallDocker(CommandCP = 0): try: statusFile = open(ServerStatusUtil.lswsInstallStatusPath, 'w') @@ -29,16 +29,20 @@ class DockerInstall: else: command = 'DEBIAN_FRONTEND=noninteractive apt-get install -y docker.io docker-compose' - if not ServerStatusUtil.executioner(command, statusFile): - logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, - "Failed to install Docker. [404]\n", 1) - return 0 + if CommandCP: + ProcessUtilities.executioner(command, 'root', True) + else: + if not ServerStatusUtil.executioner(command, statusFile): + logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, + "Failed to install Docker. [404]\n", 1) + return 0 command = 'sudo systemctl enable docker' - ServerStatusUtil.executioner(command, statusFile) + + ProcessUtilities.executioner(command, 'root', True) command = 'sudo systemctl start docker' - ServerStatusUtil.executioner(command, statusFile) + ProcessUtilities.executioner(command, 'root', True) logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, "Docker successfully installed.[200]\n", 1) diff --git a/serverStatus/serverStatusUtil.py b/serverStatus/serverStatusUtil.py index 441da05de..4f246cb54 100755 --- a/serverStatus/serverStatusUtil.py +++ b/serverStatus/serverStatusUtil.py @@ -34,7 +34,7 @@ class ServerStatusUtil(multi.Thread): @staticmethod def executioner(command, statusFile): try: - res = subprocess.call(command, stdout=statusFile, stderr=statusFile, shell=True) + res = subprocess.call(shlex.split(command), stdout=statusFile, stderr=statusFile) if res == 1: return 0 else: