summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Lint
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2013-08-09 16:45:45 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2013-08-09 16:45:45 -0400
commit0f7edd60e67d32438a8be42002faacde4e4a7649 (patch)
tree2b11b02f5bf4f9e7a6e609136bf2a19c8f166cc4 /src/lib/Bcfg2/Server/Lint
parentcc11ada6b8871d7719fd0ea8a2ff382bba8a3bc2 (diff)
downloadbcfg2-0f7edd60e67d32438a8be42002faacde4e4a7649.tar.gz
bcfg2-0f7edd60e67d32438a8be42002faacde4e4a7649.tar.bz2
bcfg2-0f7edd60e67d32438a8be42002faacde4e4a7649.zip
testsuite: fixed most pylint complaints
Diffstat (limited to 'src/lib/Bcfg2/Server/Lint')
-rw-r--r--src/lib/Bcfg2/Server/Lint/Bundler.py3
-rw-r--r--src/lib/Bcfg2/Server/Lint/Cfg.py12
-rwxr-xr-xsrc/lib/Bcfg2/Server/Lint/Genshi.py1
-rw-r--r--src/lib/Bcfg2/Server/Lint/GroupPatterns.py3
-rw-r--r--src/lib/Bcfg2/Server/Lint/MergeFiles.py8
-rw-r--r--src/lib/Bcfg2/Server/Lint/Metadata.py3
-rw-r--r--src/lib/Bcfg2/Server/Lint/Pkgmgr.py3
-rw-r--r--src/lib/Bcfg2/Server/Lint/TemplateHelper.py3
-rw-r--r--src/lib/Bcfg2/Server/Lint/__init__.py3
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()