Skip to content

Commit

Permalink
Merge pull request #25 from plesk/centos2alma-fixes
Browse files Browse the repository at this point in the history
Bring some fixes from centos2alma
  • Loading branch information
SandakovMM authored Apr 8, 2024
2 parents 8e09fd3 + 0ec94d8 commit efc9aee
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pleskdistup/actions/emails.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def _post_action(self) -> action.ActionResult:
path_to_backup = os.path.join(self.temp_directory, "dovecot.conf.bak")
if os.path.exists(self.dovecot_config_path):
shutil.copy(self.dovecot_config_path, path_to_backup)
motd.add_finish_ssh_login_message(f"The dovecot configuration '{self.dovecot_config_path}' has been restored from original distro. Modern configuration was placed in '{path_to_backup}'.")
motd.add_finish_ssh_login_message(f"The dovecot configuration '{self.dovecot_config_path}' has been restored from original distro. Modern configuration was placed in '{path_to_backup}'.\n")

files.restore_file_from_backup(self.dovecot_config_path)
return action.ActionResult()
Expand Down
2 changes: 1 addition & 1 deletion pleskdistup/actions/spamassassin.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ 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 dist.get_distro().rhel_based():
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. "
Expand Down
6 changes: 3 additions & 3 deletions pleskdistup/common/src/systemd.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
SYSTEMCTL_SERVICES_PATH = "/lib/systemd/system"


def is_service_exists(service: str):
def is_service_exists(service: str) -> bool:
res = subprocess.run([SYSTEMCTL_BIN_PATH, 'cat', service], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
return res.returncode == 0


def is_service_active(service: str):
res = subprocess.run([SYSTEMCTL_BIN_PATH, 'is-active', service])
def is_service_active(service: str) -> bool:
res = subprocess.run([SYSTEMCTL_BIN_PATH, 'is-active', service], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
return res.returncode == 0


Expand Down

0 comments on commit efc9aee

Please sign in to comment.