From 72a65ff8ea8ed73acddc0951d50f1dee44d7aeab Mon Sep 17 00:00:00 2001 From: David Murphy Date: Mon, 5 Aug 2024 12:12:16 -0600 Subject: [PATCH] Refined restart_services --- tests/support/pkg.py | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/tests/support/pkg.py b/tests/support/pkg.py index 81228be0644..bc9371ca2bf 100644 --- a/tests/support/pkg.py +++ b/tests/support/pkg.py @@ -638,26 +638,20 @@ class SaltPkgInstall: ## DGM for example: stopping service on Debian/Ubuntu when getting the _default_version ???????? """ print("DGM install_salt restart_services, entry", flush=True) - retval = True for service in ["salt-syndic", "salt-master", "salt-minion"]: check_run = self.proc.run("systemctl", "status", service) - if check_run.returncode != 0: - # The system was not started automatically and we - # are expecting it to be on install - print( - f"DGM install_salt restart_services systemctl status, The service '{service}' was not started on install, ret '{check_run}'", - flush=True, - ) - log.debug("The service %s was not started on install.", service) - retval = False - else: - restart_service = self.proc.run("systemctl", "restart", service) - print( - f"DGM install_salt restart_services systemctl restart, service '{service}', ret '{restart_service}'", - flush=True, - ) - self._check_retcode(restart_service) - return retval + print( + f"DGM install_salt restart_services systemctl status, The service '{service}' was not started on install, ret '{check_run}'", + flush=True, + ) + log.debug("The restart_services status for %s is %s.", service, check_run) + + restart_service = self.proc.run("systemctl", "restart", service) + print( + f"DGM install_salt restart_services systemctl restart, service '{service}', ret '{restart_service}'", + flush=True, + ) + self._check_retcode(restart_service) def install_previous(self, downgrade=False): """