From 325a13088cfc80765644e30eebbe77b8087aacdc Mon Sep 17 00:00:00 2001
From: Steven Armstrong <steven@icarus.ethz.ch>
Date: Fri, 14 Oct 2011 23:47:05 +0200
Subject: [PATCH] implement that type explorers are only transfered once

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
---
 lib/cdist/core/explorer.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lib/cdist/core/explorer.py b/lib/cdist/core/explorer.py
index 9dd5d210..7a868b31 100644
--- a/lib/cdist/core/explorer.py
+++ b/lib/cdist/core/explorer.py
@@ -105,10 +105,14 @@ class Explorer(object):
     def transfer_type_explorers(self, cdist_type):
         """Transfer the type explorers for the given type to the remote side."""
         if cdist_type.explorers:
-            source = os.path.join(self.local.type_path, cdist_type.explorer_path)
-            destination = os.path.join(self.remote.type_path, cdist_type.explorer_path)
-            self.remote.mkdir(destination)
-            self.remote.transfer(source, destination)
+            if cdist_type.explorers_transferred:
+                log.debug("Skipping retransfer of type explorers for: %s", cdist_type)
+            else:
+                source = os.path.join(self.local.type_path, cdist_type.explorer_path)
+                destination = os.path.join(self.remote.type_path, cdist_type.explorer_path)
+                self.remote.mkdir(destination)
+                self.remote.transfer(source, destination)
+                cdist_type.explorers_transferred = True
 
     def transfer_object_parameters(self, cdist_object):
         """Transfer the parameters for the given object to the remote side."""