From 7a0e4fa551a01105a7a0afddb431869b2627ac6a Mon Sep 17 00:00:00 2001 From: lhinds Date: Wed, 21 Jun 2017 13:32:29 +0100 Subject: [PATCH] rename gatechecks and project_config gatechecks is renamed to master_list and project_config is renamed to project_exceptions JIRA:RELENG-251 Change-Id: Icbcc2c114d687783e0720017025cb4bb8e53e8a3 Signed-off-by: lhinds --- anteater.conf | 2 +- anteater/src/get_lists.py | 17 ++++++++++------- anteater/src/project_scan.py | 2 +- gatechecks.yaml => master_list.yaml | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) rename gatechecks.yaml => master_list.yaml (98%) diff --git a/anteater.conf b/anteater.conf index 8dcc897..295099f 100644 --- a/anteater.conf +++ b/anteater.conf @@ -1,4 +1,4 @@ [config] reports_dir = .reports/ anteater_log = .reports/anteater.log -gate_checks = ./gatechecks.yaml +master_list = ./master_list.yaml diff --git a/anteater/src/get_lists.py b/anteater/src/get_lists.py index 7d6d3f1..713321f 100644 --- a/anteater/src/get_lists.py +++ b/anteater/src/get_lists.py @@ -24,15 +24,17 @@ import re config = ConfigParser.RawConfigParser() config.read('anteater.conf') logger = antlog.Logger(__name__).getLogger() -gate_checks = config.get('config', 'gate_checks') +master_list = config.get('config', 'master_list') -with open(gate_checks, 'r') as f: +with open(master_list, 'r') as f: yl = yaml.safe_load(f) + def _remove_nullvalue(contents): if contents and len(contents) > 2 and 'nullvalue' in contents: contents.remove('nullvalue') + def _merge(org, ded): ret = copy.deepcopy(org) for key in list(set([k for k in org] + [k for k in ded])): @@ -43,17 +45,18 @@ def _merge(org, ded): ret[key] = ded[key] return ret + class GetLists(object): def __init__(self, *args): # Placeholder for future args if more filters are needed self.args = args self.loaded = False - def load_project_exception_file(self, project_config, project): + def load_project_exception_file(self, project_exceptions, project): if self.loaded: return exception_file = None - for item in project_config: + for item in project_exceptions: if project in item: exception_file = item.get(project) if exception_file is not None: @@ -67,7 +70,7 @@ class GetLists(object): def binary_list(self, project): project_list = False - self.load_project_exception_file(yl.get('project_config'), project) + self.load_project_exception_file(yl.get('project_exceptions'), project) try: default_list = (yl['binaries']['binary_ignore']) except KeyError: @@ -91,7 +94,7 @@ class GetLists(object): def file_audit_list(self, project): project_list = False - self.load_project_exception_file(yl.get('project_config'), project) + self.load_project_exception_file(yl.get('project_exceptions'), project) try: default_list = set((yl['file_audits']['file_names'])) except KeyError: @@ -117,7 +120,7 @@ class GetLists(object): def file_content_list(self, project): project_list = False - self.load_project_exception_file(yl.get('project_config'), project) + self.load_project_exception_file(yl.get('project_exceptions'), project) try: default_list = set((yl['file_audits']['file_contents'])) except KeyError: diff --git a/anteater/src/project_scan.py b/anteater/src/project_scan.py index 09a4791..c7c6f28 100644 --- a/anteater/src/project_scan.py +++ b/anteater/src/project_scan.py @@ -27,7 +27,7 @@ logger = antlog.Logger(__name__).getLogger() config = ConfigParser.RawConfigParser() config.read('anteater.conf') reports_dir = config.get('config', 'reports_dir') -gate_checks = config.get('config', 'gate_checks') +master_list = config.get('config', 'master_list') ignore_dirs = ['.git'] diff --git a/gatechecks.yaml b/master_list.yaml similarity index 98% rename from gatechecks.yaml rename to master_list.yaml index 3c36539..b31b770 100644 --- a/gatechecks.yaml +++ b/master_list.yaml @@ -63,7 +63,7 @@ licence: licence_ignore: - '__init__.py' -project_config: +project_exceptions: - releng: exceptions/releng_exception.yaml - sandbox: exceptions/sandbox_exception.yaml - testproj: exceptions/sandbox_exception.yaml -- 2.16.6