From 23ae3d201af82292ad4e939569a50f2e32c689a3 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Thu, 5 May 2011 08:16:51 -0400 Subject: made bcfg2-lint error handling configurable on a much more granular level --- src/lib/Server/Lint/InfoXML.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/lib/Server/Lint/InfoXML.py') diff --git a/src/lib/Server/Lint/InfoXML.py b/src/lib/Server/Lint/InfoXML.py index 25f609902..7725ad748 100644 --- a/src/lib/Server/Lint/InfoXML.py +++ b/src/lib/Server/Lint/InfoXML.py @@ -14,9 +14,9 @@ class InfoXML(Bcfg2.Server.Lint.ServerPlugin): if (hasattr(entryset, "infoxml") and entryset.infoxml is not None): self.check_infoxml(entryset.infoxml.pnode.data) - elif ("require" in self.config and - self.config["require"].lower != "false"): - self.LintError("No info.xml found for %s" % filename) + else: + self.LintError("no-infoxml", + "No info.xml found for %s" % filename) def check_infoxml(self, xdata): for info in xdata.getroottree().findall("//Info"): @@ -26,18 +26,18 @@ class InfoXML(Bcfg2.Server.Lint.ServerPlugin): missing = [attr for attr in required if info.get(attr) is None] if missing: - self.LintError("Required attribute(s) %s not found in %s:%s" % + self.LintError("required-infoxml-attrs-missing", + "Required attribute(s) %s not found in %s:%s" % (",".join(missing), infoxml_fname, self.RenderXML(info))) - if ("require_paranoid" in self.config and - self.config["require_paranoid"].lower() == "true" and - (Bcfg2.Options.MDATA_PARANOID.value and + if ((Bcfg2.Options.MDATA_PARANOID.value and info.get("paranoid") is not None and info.get("paranoid").lower() == "false") or (not Bcfg2.Options.MDATA_PARANOID.value and (info.get("paranoid") is None or info.get("paranoid").lower() != "true"))): - self.LintError("Paranoid must be true in %s:%s" % + self.LintError("paranoid-false", + "Paranoid must be true in %s:%s" % (infoxml_fname, self.RenderXML(info))) -- cgit v1.2.3-1-g7c22