mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-06 13:25:51 +01:00
bug fix: docker install
This commit is contained in:
@@ -10,7 +10,7 @@ import time
|
|||||||
class DockerInstall:
|
class DockerInstall:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def submitInstallDocker():
|
def submitInstallDocker(CommandCP = 0):
|
||||||
try:
|
try:
|
||||||
|
|
||||||
statusFile = open(ServerStatusUtil.lswsInstallStatusPath, 'w')
|
statusFile = open(ServerStatusUtil.lswsInstallStatusPath, 'w')
|
||||||
@@ -29,16 +29,20 @@ class DockerInstall:
|
|||||||
else:
|
else:
|
||||||
command = 'DEBIAN_FRONTEND=noninteractive apt-get install -y docker.io docker-compose'
|
command = 'DEBIAN_FRONTEND=noninteractive apt-get install -y docker.io docker-compose'
|
||||||
|
|
||||||
|
if CommandCP:
|
||||||
|
ProcessUtilities.executioner(command, 'root', True)
|
||||||
|
else:
|
||||||
if not ServerStatusUtil.executioner(command, statusFile):
|
if not ServerStatusUtil.executioner(command, statusFile):
|
||||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
|
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
|
||||||
"Failed to install Docker. [404]\n", 1)
|
"Failed to install Docker. [404]\n", 1)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
command = 'sudo systemctl enable docker'
|
command = 'sudo systemctl enable docker'
|
||||||
ServerStatusUtil.executioner(command, statusFile)
|
|
||||||
|
ProcessUtilities.executioner(command, 'root', True)
|
||||||
|
|
||||||
command = 'sudo systemctl start docker'
|
command = 'sudo systemctl start docker'
|
||||||
ServerStatusUtil.executioner(command, statusFile)
|
ProcessUtilities.executioner(command, 'root', True)
|
||||||
|
|
||||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
|
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
|
||||||
"Docker successfully installed.[200]\n", 1)
|
"Docker successfully installed.[200]\n", 1)
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class ServerStatusUtil(multi.Thread):
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def executioner(command, statusFile):
|
def executioner(command, statusFile):
|
||||||
try:
|
try:
|
||||||
res = subprocess.call(command, stdout=statusFile, stderr=statusFile, shell=True)
|
res = subprocess.call(shlex.split(command), stdout=statusFile, stderr=statusFile)
|
||||||
if res == 1:
|
if res == 1:
|
||||||
return 0
|
return 0
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user