Skip to content

Commit

Permalink
Add an action to reinstall Amavis antivirus
Browse files Browse the repository at this point in the history
The Plesk Email Security extension configures Dovecot to always use Amavis for sending emails.
To ensure emails can still be sent after the conversion, we need to reinstall Amavis
More details can be found at plesk/centos2alma#288
  • Loading branch information
Mikhail Sandakov committed Aug 2, 2024
1 parent 20343c0 commit 5863ee9
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions pleskdistup/actions/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,3 +283,29 @@ def _do_check(self) -> bool:
# Therefore, it's advisable to inform users about potential issues beforehand
# If you add support for other OSes it worth to check the RAM requirements for amavis on them
return not packages.is_package_installed("amavis") or self._get_available_ram() > self.required_ram or self.amavis_upgrade_allowed


class ReinstallAmavisAntivirus(action.ActiveAction):
def __init__(self):
self.name = "reinstalling amavis antivirus"

def _is_required(self) -> bool:
return packages.is_package_installed("amavis")

def _prepare_action(self) -> action.ActionResult:
return action.ActionResult()

def _post_action(self) -> action.ActionResult:
packages.install_packages(["amavis"])

amavis_systemd_service = "amavisd.service"
if systemd.is_service_startable(amavis_systemd_service):
util.logged_check_call(["/usr/bin/systemctl", "enable", amavis_systemd_service])

return action.ActionResult()

def _revert_action(self) -> action.ActionResult:
return action.ActionResult()

def estimate_post_time(self) -> int:
return 30

0 comments on commit 5863ee9

Please sign in to comment.