Exitcode 3 just means the service is not running.

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
Pedro Algarvio 2023-12-09 10:32:58 +00:00 committed by Daniel Wozniak
parent 5216486cbf
commit cdec086831

View file

@ -868,7 +868,7 @@ class SaltPkgInstall:
ret = self.proc.run("systemctl", "daemon-reload")
self._check_retcode(ret)
ret = self.proc.run("systemctl", "status", service)
if ret.returncode in (3, 4):
if ret.returncode == 4:
log.warning(
"No systemd unit file was found for service %s. Creating one.", service
)
@ -892,7 +892,7 @@ class SaltPkgInstall:
binary = shutil.which(binary[0]) or binary[0]
elif isinstance(binary, list):
binary = " ".join(binary)
unit_path = pathlib.Path("/etc", "systemd", "system", f"{service}.service")
unit_path = pathlib.Path(f"/etc/systemd/system/{service}.service")
contents = contents.format(
service=service, tgt=binary, conf_dir=self.conf_dir
)