From b7b7ae74f83e093dd3f13faa0f068ece034b74ef Mon Sep 17 00:00:00 2001 From: Frantisek Lachman Date: Fri, 7 Jan 2022 11:42:57 +0100 Subject: [PATCH] Make the location of ruleset more generic Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2036710 Signed-off-by: Frantisek Lachman --- ci.fmf | 12 +++++++++++- colin/core/ruleset/ruleset.py | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ci.fmf b/ci.fmf index 826f6449..97f5b017 100644 --- a/ci.fmf +++ b/ci.fmf @@ -1,7 +1,17 @@ /test/build: /smoke: execute: - how: shell script: - colin --version - colin --help + framework: shell + /list-rulesets: + execute: + script: + - sh -c "cd / && colin list-rulesets" + framework: shell + /list-checks: + execute: + script: + - sh -c "cd / && colin list-checks" + framework: shell diff --git a/colin/core/ruleset/ruleset.py b/colin/core/ruleset/ruleset.py index 079c8bcc..899cfdcd 100644 --- a/colin/core/ruleset/ruleset.py +++ b/colin/core/ruleset/ruleset.py @@ -16,6 +16,7 @@ import logging import os +import sys from .loader import ( RulesetStruct, @@ -216,7 +217,7 @@ def get_ruleset_dirs(): logger.debug("Local ruleset directory found ('%s').", local_share) ruleset_dirs.append(local_share) - usr_local_share = os.path.join("/usr/local", RULESET_DIRECTORY) + usr_local_share = os.path.join(sys.prefix, RULESET_DIRECTORY) if os.path.isdir(usr_local_share): logger.debug("Global ruleset directory found ('%s').", usr_local_share) ruleset_dirs.append(usr_local_share)