From 6f615dcf9e35e341184af3bec7b0a0fee6224f35 Mon Sep 17 00:00:00 2001 From: Fredrik Eriksson Date: Sun, 12 Mar 2023 08:03:35 +0100 Subject: [PATCH] proper error message on gentoo when service could not be identified. --- sau/gentoo.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/sau/gentoo.py b/sau/gentoo.py index 3f94b4c..67a9ca3 100644 --- a/sau/gentoo.py +++ b/sau/gentoo.py @@ -24,12 +24,7 @@ def identify_service_from_bin(exe): ret, out, err = sau.helpers.exec_cmd(cmd) if ret != 0: - log.warning("searching for owner of {} failed:".format(exe)) - for line in out.splitlines(): - log.warning("stdout: {}".format(line)) - for line in err.splitlines(): - log.warning("stderr: {}".format(line)) - return None + raise sau.errors.UnknownServiceError("searching for owner of {} failed:".format(exe)) pkg = out.strip() cmd = [ EQUERY_PATH, '-Cq', 'f', pkg ] @@ -48,9 +43,9 @@ def identify_service_from_bin(exe): if match: matches.add(match.group(1)) if len(matches) < 1: - log.warning('Could not find any init script in package {}'.format(pkg)) + raise sau.errors.UnknownServiceError('Could not find any init script in package {}'.format(pkg)) elif len(matches) > 1: - log.warning('Found multiple init script in package {}'.format(pkg)) + raise.sau.errors.UnknownServiceError('Found multiple init script in package {}'.format(pkg)) else: return matches.pop() return None