diff options
-rw-r--r-- | src/lib/Server/Lint/Bundles.py | 2 | ||||
-rw-r--r-- | src/lib/Server/Lint/Comments.py | 6 | ||||
-rw-r--r-- | src/lib/Server/Lint/InfoXML.py | 2 | ||||
-rwxr-xr-x | src/sbin/bcfg2-lint | 15 |
4 files changed, 15 insertions, 10 deletions
diff --git a/src/lib/Server/Lint/Bundles.py b/src/lib/Server/Lint/Bundles.py index a1ce631c9..b242239ae 100644 --- a/src/lib/Server/Lint/Bundles.py +++ b/src/lib/Server/Lint/Bundles.py @@ -52,5 +52,5 @@ class Bundles(Bcfg2.Server.Lint.ServerPlugin): groups = [self.RenderXML(g) for g in xdata.getroottree().findall("//Group")] if groups: - self.LintError("<Group> tag is not allowed in SGenshi Bundle:\n%s" % + self.LintWarning("<Group> tag is not allowed in SGenshi Bundle:\n%s" % "\n".join(groups)) diff --git a/src/lib/Server/Lint/Comments.py b/src/lib/Server/Lint/Comments.py index 0b50df373..1b75bb25e 100644 --- a/src/lib/Server/Lint/Comments.py +++ b/src/lib/Server/Lint/Comments.py @@ -20,14 +20,14 @@ class Comments(Bcfg2.Server.Lint.ServerPlugin): def required_keywords(self, rtype): """ given a file type, fetch the list of required VCS keywords from the bcfg2-lint config """ - return self.required_items(rtype, "keyword", default=["Id"]) + return self.required_items(rtype, "keyword") def required_comments(self, rtype): """ given a file type, fetch the list of required comments from the bcfg2-lint config """ return self.required_items(rtype, "comment") - def required_items(self, rtype, itype, default=None): + def required_items(self, rtype, itype): """ given a file type and item type (comment or keyword), fetch the list of required items from the bcfg2-lint config """ if itype not in self.config_cache: @@ -38,8 +38,6 @@ class Comments(Bcfg2.Server.Lint.ServerPlugin): global_item = "global_%ss" % itype if global_item in self.config: rv.extend(self.config[global_item].split(",")) - elif default is not None: - rv.extend(default) item = "%s_%ss" % (rtype.lower(), itype) if item in self.config: diff --git a/src/lib/Server/Lint/InfoXML.py b/src/lib/Server/Lint/InfoXML.py index 42679109a..798d8c208 100644 --- a/src/lib/Server/Lint/InfoXML.py +++ b/src/lib/Server/Lint/InfoXML.py @@ -14,7 +14,7 @@ class InfoXML(Bcfg2.Server.Lint.ServerPlugin): entryset.infoxml is not None): xdata = entryset.infoxml.pnode.data for info in xdata.getroottree().findall("//Info"): - required = ["owner", "group", "perms"] + required = [] if "required_attrs" in self.config: required = self.config["required_attrs"].split(",") diff --git a/src/sbin/bcfg2-lint b/src/sbin/bcfg2-lint index 91869617f..cfb37a206 100755 --- a/src/sbin/bcfg2-lint +++ b/src/sbin/bcfg2-lint @@ -57,9 +57,14 @@ def run_plugin(plugin, plugin_name, setup=None, args=None, config=None, args.append(dict(config.items(plugin_name), **setup)) else: args.append(setup) - + + # older versions of python do not support mixing *-magic and + # non-*-magic (e.g., "plugin(*args, files=files)", so we do this + # all with *-magic + kwargs = dict(files=files) + try: - return plugin(*args, files=files).Run() + return plugin(*args, **kwargs).Run() except Exception, err: logger.error("Failed to run plugin %s: %s" % (plugin, err)) raise SystemExit(1) @@ -158,8 +163,10 @@ if __name__ == '__main__': perrors = run_server_plugins(serverplugins, config=config, setup=setup) errors = [errors[n] + perrors[n] for n in range(0, len(errors))] - print "%d errors" % errors[0] - print "%d warnings" % errors[1] + if errors[0] or errors[1] or setup['verbose']: + print "%d errors" % errors[0] + print "%d warnings" % errors[1] + if errors[0]: raise SystemExit(2) elif errors[1]: |