bug fix: email configurations reset

This commit is contained in:
Usman Nasir
2022-05-09 15:25:54 +05:00
parent 2cadf8e572
commit 4b72cebc52

View File

@@ -1039,18 +1039,21 @@ class MailServerManagerUtils(multi.Thread):
def centos_lib_dir_to_ubuntu(self, filename, old, new): def centos_lib_dir_to_ubuntu(self, filename, old, new):
try: try:
fd = open(filename, 'r') command = "sed -i 's|%s|%s|g' %s" % (old, new, filename)
lines = fd.readlines() ProcessUtilities.executioner(command, None, True)
fd.close()
fd = open(filename, 'w') # fd = open(filename, 'r')
centos_prefix = old # lines = fd.readlines()
ubuntu_prefix = new # fd.close()
for line in lines: # fd = open(filename, 'w')
index = line.find(centos_prefix) # centos_prefix = old
if index != -1: # ubuntu_prefix = new
line = line[:index] + ubuntu_prefix + line[index + len(centos_prefix):] # for line in lines:
fd.write(line) # index = line.find(centos_prefix)
fd.close() # if index != -1:
# line = line[:index] + ubuntu_prefix + line[index + len(centos_prefix):]
# fd.write(line)
# fd.close()
except BaseException as msg: except BaseException as msg:
logging.CyberCPLogFileWriter.statusWriter(self.extraArgs['tempStatusPath'], logging.CyberCPLogFileWriter.statusWriter(self.extraArgs['tempStatusPath'],
'%s [centos_lib_dir_to_ubuntu][404]' % (str(msg)), 10) '%s [centos_lib_dir_to_ubuntu][404]' % (str(msg)), 10)