2 # -*- coding: utf-8 -*-
3 ##############################################################################
4 # Copyright (c) 2017 Luke Hinds <lhinds@redhat.com>, Red Hat
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
13 Gathers various values from the gate check yaml file and return them to the
17 import anteater.utils.anteater_logger as antlog
22 config = ConfigParser.RawConfigParser()
23 config.read('anteater.conf')
24 logger = antlog.Logger(__name__).getLogger()
25 gate_checks = config.get('config', 'gate_checks')
27 with open(gate_checks, 'r') as f:
28 yl = yaml.safe_load(f)
31 class GetLists(object):
32 def __init__(self, *args):
33 # Placeholder for future args if more filters are needed
36 def binary_list(self, project):
39 default_list = (yl['binaries']['binary_ignore'])
41 logger.error('Key Error processing binary list values')
43 project_list = (yl['binaries'][project]['binary_ignore'])
45 logger.info('No binary waivers found for {0}'.
48 binary_re = re.compile("|".join(default_list),
52 binary_project_re = re.compile("|".join(project_list),
54 return binary_re, binary_project_re
56 binary_project_re = re.compile("")
57 return binary_re, binary_project_re
59 def file_audit_list(self, project):
62 default_list = set((yl['file_audits']['file_names']))
64 logger.error('Key Error processing file_names list values')
66 project_list = set((yl['file_audits'][project]['file_names']))
67 logger.info('file_names waivers found for {0}'.
70 logger.info('No file_names waivers found for {0}'.
73 file_names_re = re.compile("|".join(default_list),
77 file_names_proj_re = re.compile("|".join(project_list),
79 return file_names_re, file_names_proj_re
81 file_names_proj_re = re.compile("")
82 return file_names_re, file_names_proj_re
84 def file_content_list(self, project):
87 default_list = set((yl['file_audits']['file_contents']))
89 logger.error('Key Error processing file_contents list values')
91 project_list = set((yl['file_audits'][project]['file_contents']))
93 logger.info('No file_contents waivers found for {0}'.
96 file_contents_re = re.compile("|".join(default_list),
100 file_contents_proj_re = re.compile("|".join(project_list),
102 return file_contents_re, file_contents_proj_re
104 file_contents_proj_re = re.compile("")
105 return file_contents_re, file_contents_proj_re
107 def licence_extensions(self):
109 licence_extensions = (yl['licence']['licence_ext'])
111 logger.error('Key Error processing licence_extensions list values')
112 return licence_extensions
114 def licence_ignore(self):
116 licence_ignore = (yl['licence']['licence_ignore'])
118 logger.error('Key Error processing licence_ignore list values')
119 return licence_ignore