From e33364a370eb7dea14eef776211c729558ac7a74 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Wed, 13 May 2009 14:14:41 -0500 Subject: [PATCH] Fix to validation caching Modified logic a little --- cobbler/action_validate.py | 24 +++++++++++++----------- 1 files changed, 13 insertions(+), 11 deletions(-) diff --git a/cobbler/action_validate.py b/cobbler/action_validate.py index 55546a5..98aa5cc 100644 --- a/cobbler/action_validate.py +++ b/cobbler/action_validate.py @@ -32,10 +32,10 @@ class Validate: """ Constructor """ - self.config = config - self.settings = config.settings() - self.kickgen = kickgen.KickGen(config) - self.url_cache = [] + self.config = config + self.settings = config.settings() + self.kickgen = kickgen.KickGen(config) + self.ks_cache = [] def run(self): """ @@ -75,11 +75,19 @@ class Validate: os_version = blended["os_version"] + print "----------------------------" + ks = blended["kickstart"] if ks is None or ks == "": print "%s has no kickstart, skipping" % obj.name return [True, last_errors] + if ks in self.ks_cache: + print "Skipping kickstart %s, already checked previously" % ks + return [True, ()] + else: + self.ks_cache.append(ks) + breed = blended["breed"] if breed != "redhat": print "%s has a breed of %s, skipping" % (obj.name, breed) @@ -97,13 +105,7 @@ class Validate: self.kickgen.generate_kickstart_for_system(obj.name) last_errors = self.kickgen.get_last_errors() - print "----------------------------" - if url in self.url_cache: - print "Skipping url %s, already checked previously" % url - return [True, last_errros] - else: - print "checking url: %s" % url - self.url_cache.append(url) + print "checking url: %s" % url rc = utils.os_system("/usr/bin/ksvalidator \"%s\"" % url) if rc != 0: -- 1.5.5.1