From 6491d368d40f3de7d6c49b69b782497151d050a5 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Tue, 17 Feb 2015 08:55:23 -0600 Subject: Pylint fixes for pylint 0.28 This also pins Pylint to 0.28 or older so that we don't have to do this again. At some point we should look at upgrading to Pylint 1.x. --- src/lib/Bcfg2/Server/Lint/__init__.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (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 526bdf159..903ee6326 100644 --- a/src/lib/Bcfg2/Server/Lint/__init__.py +++ b/src/lib/Bcfg2/Server/Lint/__init__.py @@ -1,15 +1,19 @@ """ Base classes for Lint plugins and error handling """ -import os -import sys -import time import copy import fcntl +import fnmatch +import glob +import logging +import os import struct +import sys import termios -import logging import textwrap +import time + import lxml.etree + import Bcfg2.Options import Bcfg2.Server.Core import Bcfg2.Server.Plugins @@ -145,6 +149,14 @@ 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(Bcfg2.Options.setup.repository, + path)) + class ErrorHandler(object): """ A class to handle errors for bcfg2-lint plugins """ -- cgit v1.2.3-1-g7c22