update the call function

This commit is contained in:
Usman Nasir
2019-11-13 18:08:14 +05:00
parent aa327d0e4d
commit bf8de20ed5
2 changed files with 9 additions and 6 deletions

View File

@@ -219,25 +219,28 @@ class preFlightsChecks:
@staticmethod
def call(command, distro, bracket, message, log=0, do_exit=0, code=os.EX_OK):
preFlightsChecks.stdOut(message + " " + bracket, log)
finalMessage = 'Running: %s' % (message)
preFlightsChecks.stdOut(finalMessage, log)
count = 0
while True:
res = subprocess.call(shlex.split(command))
if preFlightsChecks.resFailed(distro, res):
count = count + 1
preFlightsChecks.stdOut(message + " failed, trying again, try number: " + str(count))
finalMessage = 'Running %s failed. Running again, try number %s' % (message, str(count))
preFlightsChecks.stdOut(finalMessage)
if count == 3:
fatal_message = ''
if do_exit:
fatal_message = '. Fatal error, see /var/log/installLogs.txt for full details'
preFlightsChecks.stdOut("[ERROR] We are not able to " + message + ' return code: ' + str(res) +
fatal_message + " " + bracket, 1, do_exit, code)
preFlightsChecks.stdOut("[ERROR] We are not able to run " + message + ' return code: ' + str(res) +
fatal_message + ".", 1, do_exit, code)
return False
else:
preFlightsChecks.stdOut(message + ' successful', log)
preFlightsChecks.stdOut('%s ran successfully.' % (message), log)
break
return True
def checkIfSeLinuxDisabled(self):

View File

@@ -454,7 +454,7 @@ class InstallCyberPanel:
os.remove('/etc/resolv.conf')
except OSError as e1:
InstallCyberPanel.stdOut("Unable to remove existing /etc/resolv.conf to install PowerDNS: " +
str(e1), 1, 1, os.EX_OSERR)+
str(e1), 1, 1, os.EX_OSERR)