centralized execution ph1

This commit is contained in:
usmannasir
2019-03-21 23:26:42 +05:00
parent b37907af85
commit 520bd2b797
57 changed files with 813 additions and 679 deletions

View File

@@ -39,7 +39,7 @@ class ProcessUtilities:
command = "sudo /usr/local/lsws/bin/lswsctrl restart"
cmd = shlex.split(command)
res = subprocess.call(cmd)
res = ProcessUtilities.executioner(cmd)
if res == 0:
return 1
@@ -58,7 +58,7 @@ class ProcessUtilities:
command = "sudo /usr/local/lsws/bin/lswsctrl stop"
cmd = shlex.split(command)
res = subprocess.call(cmd)
res = ProcessUtilities.executioner(cmd)
if res == 0:
return 1
@@ -68,17 +68,6 @@ class ProcessUtilities:
except subprocess.CalledProcessError, msg:
logging.writeToFile(str(msg) + "[stopLitespeed]")
@staticmethod
def executioner(command):
try:
res = subprocess.call(shlex.split(command))
if res == 0:
return 1
else:
return 0
except BaseException, msg:
return 0
@staticmethod
def killLiteSpeed():
try:
@@ -118,7 +107,7 @@ class ProcessUtilities:
def containerCheck():
try:
command = 'sudo cat /etc/cgrules.conf'
result = subprocess.call(shlex.split(command))
result = ProcessUtilities.executioner(shlex.split(command))
if result == 1:
return 0
else:
@@ -126,5 +115,24 @@ class ProcessUtilities:
except BaseException:
return 0
@staticmethod
def executioner(command):
try:
res = subprocess.call(shlex.split(command))
if res == 0:
return 1
else:
return 0
except BaseException, msg:
return 0
@staticmethod
def outputExecutioner(command):
return subprocess.check_output(shlex.split(command))
@staticmethod
def popenExecutioner(command):
return subprocess.Popen(shlex.split(command))