From cae39b746051ff5f3257342d0659340283b2d6ef Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Tue, 24 Feb 2015 16:29:07 -0600 Subject: Fix pylint errors This also pins pylint to <= 0.28 so we don't have to keep playing whack-a-mole with it. Also removes unnecessary suppression of apt warnings. This is no longer necessary in 12.04, so should be safe to remove. If you're on Ubuntu < 12.04, upgrade for heaven's sake. --- src/lib/Bcfg2/Server/Lint/__init__.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/lib/Bcfg2/Server/Lint/__init__.py') diff --git a/src/lib/Bcfg2/Server/Lint/__init__.py b/src/lib/Bcfg2/Server/Lint/__init__.py index 28644263f..ae2b81a61 100644 --- a/src/lib/Bcfg2/Server/Lint/__init__.py +++ b/src/lib/Bcfg2/Server/Lint/__init__.py @@ -1,14 +1,19 @@ """ Base classes for Lint plugins and error handling """ import os +import fnmatch +import glob import sys import logging from copy import copy import textwrap +import time + import lxml.etree import fcntl import termios import struct + from Bcfg2.Compat import walk_packages plugins = [m[1] for m in walk_packages(path=__path__)] # pylint: disable=C0103 @@ -139,6 +144,13 @@ class Plugin(object): xml_declaration=False).decode("UTF-8").strip() return " line %s: %s" % (element.sourceline, xml) + def list_matching_files(self, path): + """list all files matching the path in self.files or the bcfg2 repo.""" + if self.files is not None: + return fnmatch.filter(self.files, os.path.join('*', path)) + else: + return glob.glob(os.path.join(self.config['repo'], path)) + class ErrorHandler(object): """ A class to handle errors for bcfg2-lint plugins """ -- cgit v1.2.3-1-g7c22