From c45c9cd702098a22693ed24c5ad9b68a6db42034 Mon Sep 17 00:00:00 2001
From: Steven Armstrong <steven@icarus.ethz.ch>
Date: Wed, 19 Oct 2011 16:07:13 +0200
Subject: [PATCH] dont re-run already fulfilled requirements

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
---
 lib/cdist/config_install.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py
index cfd7e4c9..cdb76ccd 100644
--- a/lib/cdist/config_install.py
+++ b/lib/cdist/config_install.py
@@ -140,8 +140,11 @@ class ConfigInstall(object):
         for requirement in cdist_object.requirements:
             self.log.debug("Object %s requires %s", cdist_object, requirement)
             required_object = cdist_object.object_from_name(requirement)
-            self.log.info("Resolving dependency %s for %s" % (required_object.name, cdist_object.name))
-            self.object_run(required_object)
+            if required_object.state == core.Object.STATE_DONE:
+                self.log.debug("Skipping fulfilled dependency %s for %s", required_object, cdist_object)
+            else:
+                self.log.info("Resolving dependency %s for %s" % (required_object.name, cdist_object.name))
+                self.object_run(required_object)
 
         self.log.info("Running gencode and code for " + cdist_object.name)