From c6285c33c4d3c0ecff377cca2d7c3f0fc8a729af Mon Sep 17 00:00:00 2001 From: usmannasir Date: Thu, 19 Sep 2024 14:18:42 +0500 Subject: [PATCH] bug fix: mail debugger on al9 --- plogical/mailUtilities.py | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/plogical/mailUtilities.py b/plogical/mailUtilities.py index b93132c22..8a9655bff 100755 --- a/plogical/mailUtilities.py +++ b/plogical/mailUtilities.py @@ -1709,6 +1709,32 @@ def RunServerLevelEmailChecks(self): final_json = json.dumps(final_dic) return HttpResponse(final_json) + + def FetchCloudLinuxAlmaVersionVersion(self): + if os.path.exists('/etc/os-release'): + data = open('/etc/os-release', 'r').read() + if (data.find('CloudLinux') > -1 or data.find('cloudlinux') > -1) and ( + data.find('8.9') > -1 or data.find('Anatoly Levchenko') > -1 or data.find('VERSION="8.') > -1): + return 'cl-89' + elif (data.find('CloudLinux') > -1 or data.find('cloudlinux') > -1) and ( + data.find('8.8') > -1 or data.find('Anatoly Filipchenko') > -1): + return 'cl-88' + elif (data.find('CloudLinux') > -1 or data.find('cloudlinux') > -1) and ( + data.find('9.4') > -1 or data.find('VERSION="9.') > -1): + return 'cl-88' + elif (data.find('AlmaLinux') > -1 or data.find('almalinux') > -1) and ( + data.find('8.9') > -1 or data.find('Midnight Oncilla') > -1 or data.find('VERSION="8.') > -1): + return 'al-88' + elif (data.find('AlmaLinux') > -1 or data.find('almalinux') > -1) and ( + data.find('8.7') > -1 or data.find('Stone Smilodon') > -1): + return 'al-87' + elif (data.find('AlmaLinux') > -1 or data.find('almalinux') > -1) and ( + data.find('9.4') > -1 or data.find('9.3') > -1 or data.find('Shamrock Pampas') > -1 or data.find( + 'Seafoam Ocelot') > -1 or data.find('VERSION="9.') > -1): + return 'al-93' + else: + return -1 + def install_postfix_dovecot(self): try: @@ -1752,8 +1778,17 @@ def install_postfix_dovecot(self): command = 'yum install --enablerepo=gf-plus -y postfix3 postfix3-ldap postfix3-mysql postfix3-pcre' elif ProcessUtilities.decideDistro() == ProcessUtilities.cent8: - command = 'dnf --nogpg install -y https://mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el8.noarch.rpm' - ProcessUtilities.executioner(command) + clAPVersion = self.FetchCloudLinuxAlmaVersionVersion() + type = clAPVersion.split('-')[0] + version = int(clAPVersion.split('-')[1]) + + if type == 'al' and version >= 90: + command = 'dnf --nogpg install -y https://mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el9.noarch.rpm' + ProcessUtilities.executioner(command) + + else: + command = 'dnf --nogpg install -y https://mirror.ghettoforge.org/distributions/gf/gf-release-latest.gf.el8.noarch.rpm' + ProcessUtilities.executioner(command) command = 'dnf install --enablerepo=gf-plus postfix3 postfix3-mysql -y' else: