diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2015-02-17 08:55:23 -0600 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2015-02-17 09:05:10 -0600 |
commit | 6491d368d40f3de7d6c49b69b782497151d050a5 (patch) | |
tree | fff48c07ef6ff75b4e27e717cf12e3574f60db35 /src/lib/Bcfg2/Server/Lint/ValidateJSON.py | |
parent | f4d30301fd4b7dca4375875aedae59e5c3542a34 (diff) | |
download | bcfg2-6491d368d40f3de7d6c49b69b782497151d050a5.tar.gz bcfg2-6491d368d40f3de7d6c49b69b782497151d050a5.tar.bz2 bcfg2-6491d368d40f3de7d6c49b69b782497151d050a5.zip |
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.
Diffstat (limited to 'src/lib/Bcfg2/Server/Lint/ValidateJSON.py')
-rw-r--r-- | src/lib/Bcfg2/Server/Lint/ValidateJSON.py | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/lib/Bcfg2/Server/Lint/ValidateJSON.py b/src/lib/Bcfg2/Server/Lint/ValidateJSON.py index 6383a3c99..f7cf5d549 100644 --- a/src/lib/Bcfg2/Server/Lint/ValidateJSON.py +++ b/src/lib/Bcfg2/Server/Lint/ValidateJSON.py @@ -1,11 +1,13 @@ -"""Ensure that all JSON files in the Bcfg2 repository are +"""Validate JSON files. + +Ensure that all JSON files in the Bcfg2 repository are valid. Currently, the only plugins that uses JSON are Ohai and -Properties.""" +Properties. +""" import os import sys -import glob -import fnmatch + import Bcfg2.Server.Lint try: @@ -48,18 +50,11 @@ class ValidateJSON(Bcfg2.Server.Lint.ServerlessPlugin): def get_files(self): """Return a list of all JSON files to validate, based on :attr:`Bcfg2.Server.Lint.ValidateJSON.ValidateJSON.globs`. """ - 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(Bcfg2.Options.setup.repository, p)) - rv = [] for path in self.globs: if '/**/' in path: if self.files is not None: - rv.extend(listfiles(path)) + rv.extend(self.list_matching_files(path)) else: # self.files is None fpath, fname = path.split('/**/') for root, _, files in os.walk( @@ -68,5 +63,5 @@ class ValidateJSON(Bcfg2.Server.Lint.ServerlessPlugin): rv.extend([os.path.join(root, f) for f in files if f == fname]) else: - rv.extend(listfiles(path)) + rv.extend(self.list_matching_files(path)) return rv |