summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Lint/Validate.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Bcfg2/Server/Lint/Validate.py')
-rw-r--r--src/lib/Bcfg2/Server/Lint/Validate.py25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/lib/Bcfg2/Server/Lint/Validate.py b/src/lib/Bcfg2/Server/Lint/Validate.py
index 3efcc890d..1e33ec398 100644
--- a/src/lib/Bcfg2/Server/Lint/Validate.py
+++ b/src/lib/Bcfg2/Server/Lint/Validate.py
@@ -1,12 +1,16 @@
-""" Ensure that all XML files in the Bcfg2 repository validate
-according to their respective schemas. """
+"""Validate XML files.
+Ensure that all XML files in the Bcfg2 repository validate according
+to their respective schemas.
+"""
+
+import glob
import os
import sys
-import glob
-import fnmatch
+
import lxml.etree
from subprocess import Popen, PIPE, STDOUT
+
import Bcfg2.Server.Lint
@@ -204,17 +208,10 @@ class Validate(Bcfg2.Server.Lint.ServerlessPlugin):
values are lists of the full paths to all files in the Bcfg2
repository (or given with ``bcfg2-lint --stdin``) that match
the glob."""
- if self.files is not None:
- listfiles = lambda p: fnmatch.filter(self.files,
- os.path.join('*', p))
- else:
- listfiles = lambda p: glob.glob(os.path.join(self.config['repo'],
- p))
-
for path in self.filesets.keys():
if '/**/' in path:
if self.files is not None:
- self.filelists[path] = listfiles(path)
+ self.filelists[path] = self.list_matching_files(path)
else: # self.files is None
fpath, fname = path.split('/**/')
self.filelists[path] = []
@@ -225,9 +222,9 @@ class Validate(Bcfg2.Server.Lint.ServerlessPlugin):
for f in files
if f == fname])
else:
- self.filelists[path] = listfiles(path)
+ self.filelists[path] = self.list_matching_files(path)
- self.filelists['props'] = listfiles("Properties/*.xml")
+ self.filelists['props'] = self.list_matching_files("Properties/*.xml")
def _load_schema(self, filename):
""" Load an XML schema document, returning the Schema object