diff options
Diffstat (limited to 'src/lib/Bcfg2/Server/Lint')
-rw-r--r-- | src/lib/Bcfg2/Server/Lint/Bundler.py | 3 | ||||
-rw-r--r-- | src/lib/Bcfg2/Server/Lint/Cfg.py | 12 | ||||
-rwxr-xr-x | src/lib/Bcfg2/Server/Lint/Genshi.py | 1 | ||||
-rw-r--r-- | src/lib/Bcfg2/Server/Lint/GroupPatterns.py | 3 | ||||
-rw-r--r-- | src/lib/Bcfg2/Server/Lint/MergeFiles.py | 8 | ||||
-rw-r--r-- | src/lib/Bcfg2/Server/Lint/Metadata.py | 3 | ||||
-rw-r--r-- | src/lib/Bcfg2/Server/Lint/Pkgmgr.py | 3 | ||||
-rw-r--r-- | src/lib/Bcfg2/Server/Lint/TemplateHelper.py | 3 | ||||
-rw-r--r-- | src/lib/Bcfg2/Server/Lint/__init__.py | 3 |
9 files changed, 31 insertions, 8 deletions
diff --git a/src/lib/Bcfg2/Server/Lint/Bundler.py b/src/lib/Bcfg2/Server/Lint/Bundler.py index b41313349..0caf4d7ed 100644 --- a/src/lib/Bcfg2/Server/Lint/Bundler.py +++ b/src/lib/Bcfg2/Server/Lint/Bundler.py @@ -1,3 +1,6 @@ +""" ``bcfg2-lint`` plugin for :ref:`Bundler +<server-plugins-structures-bundler-index>` """ + from Bcfg2.Server.Lint import ServerPlugin diff --git a/src/lib/Bcfg2/Server/Lint/Cfg.py b/src/lib/Bcfg2/Server/Lint/Cfg.py index 4cdf5c48a..2cdb1f7b8 100644 --- a/src/lib/Bcfg2/Server/Lint/Cfg.py +++ b/src/lib/Bcfg2/Server/Lint/Cfg.py @@ -1,4 +1,10 @@ +""" ``bcfg2-lint`` plugin for :ref:`Cfg +<server-plugins-generators-cfg>` """ + + import os +import Bcfg2.Options +from fnmatch import fnmatch from Bcfg2.Server.Lint import ServerPlugin @@ -55,7 +61,7 @@ class Cfg(ServerPlugin): # first, collect ignore patterns from handlers ignore = set() - for hdlr in handlers(): + for hdlr in cfg.handlers(): ignore.update(hdlr.__ignore__) # next, get a list of all non-ignored files on the filesystem @@ -67,9 +73,9 @@ class Cfg(ServerPlugin): # global FAM ignore list if (not any(fname.endswith("." + i) for i in ignore) and not any(fnmatch(fpath, p) - for p in self.config['ignore']) and + for p in Bcfg2.Options.setup.ignore_files) and not any(fnmatch(c, p) - for p in self.config['ignore'] + for p in sBcfg2.Options.setup.ignore_files for c in self._list_path_components(fpath))): all_files.add(fpath) diff --git a/src/lib/Bcfg2/Server/Lint/Genshi.py b/src/lib/Bcfg2/Server/Lint/Genshi.py index 76e1986f9..e3a0004a6 100755 --- a/src/lib/Bcfg2/Server/Lint/Genshi.py +++ b/src/lib/Bcfg2/Server/Lint/Genshi.py @@ -22,6 +22,7 @@ class Genshi(Bcfg2.Server.Lint.ServerPlugin): "unknown-genshi-error": "error"} def check_template(self, loader, fname, cls=None): + """ Generic check for all genshi templates (XML and text) """ try: loader.load(fname, cls=cls) except TemplateSyntaxError: diff --git a/src/lib/Bcfg2/Server/Lint/GroupPatterns.py b/src/lib/Bcfg2/Server/Lint/GroupPatterns.py index 8a0ab4f18..d8142cab9 100644 --- a/src/lib/Bcfg2/Server/Lint/GroupPatterns.py +++ b/src/lib/Bcfg2/Server/Lint/GroupPatterns.py @@ -1,3 +1,6 @@ +""" ``bcfg2-lint`` plugin for :ref:`GroupPatterns +<server-plugins-grouping-grouppatterns>` """ + import sys from Bcfg2.Server.Lint import ServerPlugin from Bcfg2.Server.Plugins.GroupPatterns import PatternMap diff --git a/src/lib/Bcfg2/Server/Lint/MergeFiles.py b/src/lib/Bcfg2/Server/Lint/MergeFiles.py index dff95fbf3..972475d91 100644 --- a/src/lib/Bcfg2/Server/Lint/MergeFiles.py +++ b/src/lib/Bcfg2/Server/Lint/MergeFiles.py @@ -11,10 +11,10 @@ from Bcfg2.Server.Plugins.Cfg import CfgGenerator def threshold(val): """ Option type processor to accept either a percentage (e.g., "threshold=75") or a ratio (e.g., "threshold=.75") """ - threshold = float(val) - if threshold > 1: - threshold /= 100 - return threshold + rv = float(val) + if rv > 1: + rv /= 100 + return rv class MergeFiles(Bcfg2.Server.Lint.ServerPlugin): diff --git a/src/lib/Bcfg2/Server/Lint/Metadata.py b/src/lib/Bcfg2/Server/Lint/Metadata.py index a349805fd..3c8f2831d 100644 --- a/src/lib/Bcfg2/Server/Lint/Metadata.py +++ b/src/lib/Bcfg2/Server/Lint/Metadata.py @@ -1,3 +1,6 @@ +""" ``bcfg2-lint`` plugin for :ref:`Metadata +<server-plugins-grouping-metadata>` """ + from Bcfg2.Server.Lint import ServerPlugin diff --git a/src/lib/Bcfg2/Server/Lint/Pkgmgr.py b/src/lib/Bcfg2/Server/Lint/Pkgmgr.py index 54f6f07d1..6b718d8b5 100644 --- a/src/lib/Bcfg2/Server/Lint/Pkgmgr.py +++ b/src/lib/Bcfg2/Server/Lint/Pkgmgr.py @@ -1,3 +1,6 @@ +""" ``bcfg2-lint`` plugin for :ref:`Pkgmgr +<server-plugins-generators-pkgmgr>` """ + import os import glob import lxml.etree diff --git a/src/lib/Bcfg2/Server/Lint/TemplateHelper.py b/src/lib/Bcfg2/Server/Lint/TemplateHelper.py index a24d70cab..1b4642a95 100644 --- a/src/lib/Bcfg2/Server/Lint/TemplateHelper.py +++ b/src/lib/Bcfg2/Server/Lint/TemplateHelper.py @@ -1,3 +1,6 @@ +""" ``bcfg2-lint`` plugin for :ref:`TemplateHelper +<server-plugins-connectors-templatehelper>` """ + import sys import imp from Bcfg2.Server.Lint import ServerPlugin diff --git a/src/lib/Bcfg2/Server/Lint/__init__.py b/src/lib/Bcfg2/Server/Lint/__init__.py index 4f64fd006..c8cdb5be1 100644 --- a/src/lib/Bcfg2/Server/Lint/__init__.py +++ b/src/lib/Bcfg2/Server/Lint/__init__.py @@ -346,7 +346,6 @@ class CLI(object): except ImportError: # no lint plugin for this server plugin self.logger.debug("No lint plugin for %s" % plugin.__name__) - pass except AttributeError: self.logger.error("Failed to load plugin %s: %s" % (plugin.__name__, sys.exc_info()[1])) @@ -369,6 +368,7 @@ class CLI(object): self.serverlessplugins.append(plugin) def run(self): + """ Run bcfg2-lint """ if Bcfg2.Options.setup.list_errors: for plugin in self.serverplugins + self.serverlessplugins: self.errorhandler.RegisterErrors(getattr(plugin, 'Errors')()) @@ -441,6 +441,7 @@ class CLI(object): core.shutdown() def _run_plugin(self, plugin, args=None): + """ Run a single bcfg2-lint plugin """ if args is None: args = [] start = time.time() |