summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-04-20 11:20:47 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-04-20 12:00:19 -0400
commit27ffebf6e6e0268470214396a71d61eda8d9574b (patch)
tree5d435eca0e7439b89768b72fd08328a797d01a11 /src/lib
parent232963077d5883d3e7b15ad15a10063bb1986de9 (diff)
downloadbcfg2-27ffebf6e6e0268470214396a71d61eda8d9574b.tar.gz
bcfg2-27ffebf6e6e0268470214396a71d61eda8d9574b.tar.bz2
bcfg2-27ffebf6e6e0268470214396a71d61eda8d9574b.zip
make bcfg2-lint warn about .cat and .diff files
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Bcfg2/Server/Lint/Deltas.py20
-rw-r--r--src/lib/Bcfg2/Server/Lint/__init__.py7
2 files changed, 25 insertions, 2 deletions
diff --git a/src/lib/Bcfg2/Server/Lint/Deltas.py b/src/lib/Bcfg2/Server/Lint/Deltas.py
new file mode 100644
index 000000000..7627b0cb0
--- /dev/null
+++ b/src/lib/Bcfg2/Server/Lint/Deltas.py
@@ -0,0 +1,20 @@
+import Bcfg2.Server.Lint
+
+class Deltas(Bcfg2.Server.Lint.ServerPlugin):
+ """ Warn about usage of .cat and .diff files """
+
+ def Run(self):
+ """ run plugin """
+ if 'Cfg' in self.core.plugins:
+ cfg = self.core.plugins['Cfg']
+ for basename, entry in list(cfg.entries.items()):
+ self.check_entry(basename, entry)
+
+ def check_entry(self, basename, entry):
+ for fname in list(entry.entries.keys()):
+ match = entry.specific.delta_reg.match(fname)
+ if match:
+ self.LintError("%s-file-used" % match.group('delta'),
+ "%s file used on %s: %s" % (match.group('delta'),
+ basename,
+ fname))
diff --git a/src/lib/Bcfg2/Server/Lint/__init__.py b/src/lib/Bcfg2/Server/Lint/__init__.py
index 82770333a..286dae807 100644
--- a/src/lib/Bcfg2/Server/Lint/__init__.py
+++ b/src/lib/Bcfg2/Server/Lint/__init__.py
@@ -6,7 +6,8 @@ __all__ = ['Bundles',
'Pkgmgr',
'RequiredAttrs',
'Validate',
- 'Genshi']
+ 'Genshi',
+ 'Deltas']
import logging
import os
@@ -117,7 +118,9 @@ class ErrorHandler (object):
"merge-probes":"warning",
"input-output-error":"error",
"genshi-syntax-error":"error",
- "pattern-fails-to-initialize":"error"}
+ "pattern-fails-to-initialize":"error",
+ "cat-file-used":"warning",
+ "diff-file-used":"warning"}
def __init__(self, config=None):
self.errors = 0