From 8de14d400ad121abefd97350337c64717b3288d4 Mon Sep 17 00:00:00 2001 From: Mikhail Sandakov Date: Fri, 5 Apr 2024 15:15:03 +0300 Subject: [PATCH 1/3] Suppress the output when calling systemctl is-active --- pleskdistup/common/src/systemd.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pleskdistup/common/src/systemd.py b/pleskdistup/common/src/systemd.py index faf50eb..e9428b3 100644 --- a/pleskdistup/common/src/systemd.py +++ b/pleskdistup/common/src/systemd.py @@ -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 From 088dfc52c2fcdd19960aa24f979051831f57f3a7 Mon Sep 17 00:00:00 2001 From: Mikhail Sandakov Date: Fri, 5 Apr 2024 15:16:09 +0300 Subject: [PATCH 2/3] Fix dovector configurations saved motd message --- pleskdistup/actions/emails.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pleskdistup/actions/emails.py b/pleskdistup/actions/emails.py index 48c7938..39632a1 100644 --- a/pleskdistup/actions/emails.py +++ b/pleskdistup/actions/emails.py @@ -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() From 0ec94d8d310f78367725b5cd32eb0cdd9d789803 Mon Sep 17 00:00:00 2001 From: Mikhail Sandakov Date: Fri, 5 Apr 2024 17:55:51 +0300 Subject: [PATCH 3/3] Checking if distro is rhel based is not a function anymore --- pleskdistup/actions/spamassassin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pleskdistup/actions/spamassassin.py b/pleskdistup/actions/spamassassin.py index 9a1fd57..cac5f42 100644 --- a/pleskdistup/actions/spamassassin.py +++ b/pleskdistup/actions/spamassassin.py @@ -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. "