summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/Bcfg2/Server/Lint/Deltas.py20
-rw-r--r--src/lib/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/Server/Lint/__init__.py b/src/lib/Server/Lint/__init__.py
index a9d57c46c..ff5293a81 100644
--- a/src/lib/Server/Lint/__init__.py
+++ b/src/lib/Server/Lint/__init__.py
@@ -8,7 +8,8 @@ __all__ = ['Bundles',
'Pkgmgr',
'RequiredAttrs',
'Validate',
- 'Genshi']
+ 'Genshi',
+ 'Deltas']
import logging
import os
@@ -119,7 +120,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