link to emulator in config_install and remove it from emulator

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-10-07 12:10:57 +02:00
parent 8a4b8e9b66
commit b936fea3e5
2 changed files with 11 additions and 17 deletions

View file

@ -37,9 +37,7 @@ CODE_HEADER = "#!/bin/sh -e\n"
class ConfigInstall:
"""Cdist main class to hold arbitrary data"""
def __init__(self, target_host,
initial_manifest=False,
home=None,
def __init__(self, target_host, initial_manifest=False,
exec_path=sys.argv[0],
debug=False):
@ -51,7 +49,6 @@ class ConfigInstall:
self.path = cdist.path.Path(self.target_host,
initial_manifest=initial_manifest,
base_dir=home,
debug=debug)
def cleanup(self):
@ -84,10 +81,7 @@ class ConfigInstall:
cdist.exec.run_or_fail(remote_cmd, stdout=output_fd, remote_prefix=True)
output_fd.close()
def link_emulator(self):
"""Link emulator to types"""
cdist.emulator.link(self.exec_path,
self.path.bin_dir, self.path.list_types())
def run_initial_manifest(self):
"""Run the initial manifest"""
@ -208,6 +202,15 @@ class ConfigInstall:
cdist.exec.run_or_fail([remote_remote_code], remote_prefix=True)
### Cleaned / check functions: Round 1 :-) #################################
def link_emulator(self):
"""Link emulator to types"""
src = os.path.abspath(self.exec_path)
for type in cdist.core.Type.list_types():
log.debug("Linking emulator: %s to %s", source, destination)
dst = os.path.join(self.context.bin_dir, type.name)
# FIXME: handle exception / make it more beautiful
os.symlink(src, dst)
def run_global_explorers(self):
"""Run global explorers"""
log.info("Running global explorers")

View file

@ -142,12 +142,3 @@ def run(argv):
source_fd.close()
log.debug("Finished " + type + "/" + object_id + repr(params))
def link(exec_path, bin_dir, type_list):
"""Link type names to cdist-type-emulator"""
source = os.path.abspath(exec_path)
for type in type_list:
destination = os.path.join(bin_dir, type)
log.debug("Linking %s to %s", source, destination)
os.symlink(source, destination)