diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-05-15 09:53:04 -0400 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-05-15 09:53:04 -0400 |
commit | 4df3945eeecb31e3234e894202868a373c95e3aa (patch) | |
tree | ff6f26f8ea84930e9f43de7ba618dd8495fcb12f /src/lib/Server/Lint/Deltas.py | |
parent | 5a4a6fc2a913d5609d3e69ae04fee55fa1c521e1 (diff) | |
parent | 00ee09dcea30e0afa6d22331d6e2eff624f928d3 (diff) | |
download | bcfg2-4df3945eeecb31e3234e894202868a373c95e3aa.tar.gz bcfg2-4df3945eeecb31e3234e894202868a373c95e3aa.tar.bz2 bcfg2-4df3945eeecb31e3234e894202868a373c95e3aa.zip |
merged maint
Diffstat (limited to 'src/lib/Server/Lint/Deltas.py')
-rw-r--r-- | src/lib/Server/Lint/Deltas.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/lib/Server/Lint/Deltas.py b/src/lib/Server/Lint/Deltas.py new file mode 100644 index 000000000..114f2e348 --- /dev/null +++ b/src/lib/Server/Lint/Deltas.py @@ -0,0 +1,25 @@ +import Bcfg2.Server.Lint +from Bcfg2.Server.Plugins.Cfg import CfgFilter + +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) + + @classmethod + def Errors(cls): + return {"cat-file-used":"warning", + "diff-file-used":"warning"} + + def check_entry(self, basename, entry): + for fname, processor in entry.entries.items(): + if self.HandlesFile(fname) and isinstance(processor, CfgFilter): + extension = fname.split(".")[-1] + self.LintError("%s-file-used" % extension, + "%s file used on %s: %s" % + (extension, basename, fname)) |