From edebc8b69f47b5a964375526f6620b6153b83181 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Thu, 19 Sep 2024 14:51:35 +0500 Subject: [PATCH] bug fix: fix empty resolv.conf in al8 reset email config --- plogical/mailUtilities.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/plogical/mailUtilities.py b/plogical/mailUtilities.py index 8a9655bff..fea4870eb 100755 --- a/plogical/mailUtilities.py +++ b/plogical/mailUtilities.py @@ -2533,6 +2533,23 @@ def ResetEmailConfigurations(self): command = 'touch /home/cyberpanel/postfix' ProcessUtilities.executioner(command) + ### + + etcResolve = '/etc/resolv.conf' + + dataEtcResolv = open(etcResolve, 'r').read() + + if len(dataEtcResolv) < 4: + writeToFile = open(etcResolve, 'w') + writeToFile.write('nameserver 8.8.8.8\n') + writeToFile.close() + + command = 'systemctl restart postfix' + ProcessUtilities.executioner(command) + + command = 'systemctl restart dovecot' + ProcessUtilities.executioner(command) + logging.CyberCPLogFileWriter.statusWriter(self.extraArgs['tempStatusPath'], 'Completed [200].') except BaseException as msg: