Skip to content

Commit

Permalink
fixup! Adopt ruby reboundle action for deb-based distros
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikhail Sandakov committed Feb 16, 2024
1 parent b8c3c3e commit 8f017ee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions pleskdistup/actions/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def _get_ruby_application_path_by_bundle_subdir(self, domain_home: str) -> typin
return os.path.dirname(os.path.dirname(bundle))

def _get_ruby_application_paths(self, domain_path: str) -> typing.Tuple[typing.Optional[str], typing.Optional[str]]:
app_directory = self._get_ruby_application_path_by_config(domain_path.name)
app_directory = self._get_ruby_application_path_by_config(domain_path)
if app_directory is None:
log.debug(f"Ruby application is disabled. Search for application root in filesystem. Domain home directory: {domain_path}")
app_directory = self._get_ruby_application_path_by_bundle_subdir(domain_path)
Expand All @@ -110,12 +110,12 @@ def _get_ruby_application_paths(self, domain_path: str) -> typing.Tuple[typing.O

def _post_action(self) -> action.ActionResult:
for domain_path in self._get_ruby_domains():
log.debug(f"Re-bundling ruby application in domain: {domain_path.name}")
log.debug(f"Re-bundling ruby application in domain: {domain_path}")

app_directory, bundle = self._get_ruby_application_paths(domain_path)

if bundle is None or not os.path.isdir(bundle):
log.debug(f"Skip re-bundling for non bundling domain '{domain_path.name}'")
log.debug(f"Skip re-bundling for non bundling domain '{domain_path}'")
continue

stat_info = os.stat(app_directory)
Expand Down
14 changes: 8 additions & 6 deletions pleskdistup/actions/spamassassin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import os
import shutil

from pleskdistup.common import action, packages, motd, rpm, util
from pleskdistup.common import action, dist, packages, motd, rpm, util

SPAMASSASIN_CONFIG_PATH = "/etc/mail/spamassassin/init.pre"

Expand Down Expand Up @@ -59,11 +59,13 @@ def _post_action(self) -> action.ActionResult:
# TODO. Following action is not supported on deb-based system. Actually it will be just skipped.
# So if you are going to use the action on deb-based, you should be ready there will be no .rpmnew
# things or even file here (obviously).
if rpm.handle_rpmnew(SPAMASSASIN_CONFIG_PATH):
motd.add_finish_ssh_login_message(
f"Note that spamassasin configuration '{SPAMASSASIN_CONFIG_PATH}' was changed during conversion. "
f"Original configuration can be found in {SPAMASSASIN_CONFIG_PATH}.rpmsave."
)
if dist.get_distro().rhel_based():
if rpm.handle_rpmnew(SPAMASSASIN_CONFIG_PATH):
motd.add_finish_ssh_login_message(
f"Note that spamassasin configuration '{SPAMASSASIN_CONFIG_PATH}' was changed during conversion. "
f"Original configuration can be found in {SPAMASSASIN_CONFIG_PATH}.rpmsave."
)

return action.ActionResult()

def _revert_action(self) -> action.ActionResult:
Expand Down

0 comments on commit 8f017ee

Please sign in to comment.