From 5f358a5ef124bacbed18ab046b8ea4c3ee22d274 Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Wed, 12 Oct 2011 16:46:54 +0200 Subject: [PATCH] move link_emulator to local Signed-off-by: Steven Armstrong --- lib/cdist/exec/local.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/cdist/exec/local.py b/lib/cdist/exec/local.py index 18454b8f..aec65e68 100644 --- a/lib/cdist/exec/local.py +++ b/lib/cdist/exec/local.py @@ -30,6 +30,7 @@ import shutil import logging import cdist +from cdist import core class LocalScriptError(cdist.Error): @@ -118,3 +119,13 @@ class Local(object): raise LocalScriptError(script, command, script_content) except EnvironmentError as error: raise cdist.Error(" ".join(command) + ": " + error.args[1]) + + def link_emulator(self, exec_path): + """Link emulator to types""" + src = os.path.abspath(exec_path) + for cdist_type in core.Type.list_types(self.type_base_path): + dst = os.path.join(self.bin_path, cdist_type.name) + self.log.debug("Linking emulator: %s to %s", src, dst) + + # FIXME: handle exceptions + os.symlink(src, dst)