fixed pkg parsing in freebsd

This commit is contained in:
Fredrik Eriksson 2019-04-18 10:43:57 +02:00
parent 6f69be3f6a
commit 45eefb251b
No known key found for this signature in database
GPG Key ID: 8825C73A0FD1502A

View File

@ -23,13 +23,13 @@ def identify_service_from_bin(exe):
ret, pkg, err = sau.helpers.exec_cmd(cmd) ret, pkg, err = sau.helpers.exec_cmd(cmd)
if not pkg: if not pkg:
raise sau.errors.UnknownServiceError("'{}' does not belong to any package".format(exe)) raise sau.errors.UnknownServiceError("'{}' does not belong to any package".format(exe))
pkg = pkg.decode('utf-8').strip() pkg = pkg.strip()
log.debug('{} belongs to package {}'.format(exe, pkg)) log.debug('{} belongs to package {}'.format(exe, pkg))
cmd = [ PKG_PATH, 'info', '-l', pkg ] cmd = [ PKG_PATH, 'info', '-l', pkg ]
ret, out, err = sau.helpers.exec_cmd(cmd) ret, out, err = sau.helpers.exec_cmd(cmd)
rc_scripts = set() rc_scripts = set()
for line in out.decode('utf-8').splitlines(): for line in out.splitlines():
match = re.match(rc_script_re, line.strip()) match = re.match(rc_script_re, line.strip())
if match: if match:
log.debug('found potential rc-script for {} at {}'.format(exe, match.group(1))) log.debug('found potential rc-script for {} at {}'.format(exe, match.group(1)))