summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Server/Lint/Deltas.py
blob: 7627b0cb05f33d57785be5c9f90dd7baeffdc765 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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))