move link_emulator to local
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
parent
117ccf94d3
commit
5f358a5ef1
1 changed files with 11 additions and 0 deletions
|
@ -30,6 +30,7 @@ import shutil
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import cdist
|
import cdist
|
||||||
|
from cdist import core
|
||||||
|
|
||||||
|
|
||||||
class LocalScriptError(cdist.Error):
|
class LocalScriptError(cdist.Error):
|
||||||
|
@ -118,3 +119,13 @@ class Local(object):
|
||||||
raise LocalScriptError(script, command, script_content)
|
raise LocalScriptError(script, command, script_content)
|
||||||
except EnvironmentError as error:
|
except EnvironmentError as error:
|
||||||
raise cdist.Error(" ".join(command) + ": " + error.args[1])
|
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)
|
||||||
|
|
Loading…
Reference in a new issue