add some meat to object_run()

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-09-10 14:45:59 +02:00
parent beafb55e12
commit 636995f44e

View file

@ -372,13 +372,12 @@ class Cdist:
cmd = [] cmd = []
cmd.append("__explorer=" + REMOTE_GLOBAL_EXPLORER_DIR) cmd.append("__explorer=" + REMOTE_GLOBAL_EXPLORER_DIR)
cmd.append("__type_explorer=" + self.remote_type_explorer_dir(type)) cmd.append("__type_explorer=" + self.remote_type_explorer_dir(type))
cmd.append("__global =" + self.out_dir) cmd.append("__object=" + self.remote_object_dir(cdist_object))
cmd.append("__object_id=" + self.get_object_id_from_object(cdist_object)) cmd.append("__object_id=" + self.get_object_id_from_object(cdist_object))
cmd.append("__object_fq=" + cdist_object) cmd.append("__object_fq=" + cdist_object)
# Need to transfer at least the parameters for objects to be useful # Need to transfer at least the parameters for objects to be useful
self.transfer_object_parameter(cdist_object) self.transfer_object_parameter(cdist_object)
cmd.append("__object=" + self.remote_object_dir(cdist_object))
explorers = self.list_type_explorers(type) explorers = self.list_type_explorers(type)
for explorer in explorers: for explorer in explorers:
@ -459,28 +458,29 @@ class Cdist:
def object_run(self, cdist_object, mode): def object_run(self, cdist_object, mode):
"""Run gencode or code for an object""" """Run gencode or code for an object"""
# FIXME: Check requirements and execute those before # FIXME: Check requirements and execute those before
requirements = list_object_requirements(cdist_object) requirements = self.list_object_requirements(cdist_object)
for requirement in requirements: for requirement in requirements:
object_run(requirement, mode=mode) self.object_run(requirement, mode=mode)
# Find and run all available gencode scripts # Find and run all available gencode scripts
if mode == "gencode": if mode == "gencode":
paths = self.type_gencode_paths(self.get_type_from_object(cdist_object)) paths = self.type_gencode_paths(self.get_type_from_object(cdist_object))
if mode == "code": if mode == "code":
paths = self.object_code_paths(cdist_object) paths = self.object_code_paths(cdist_object)
# FIXME: to be implemented # FIXME: to be implemented
# cdist-object-gencode-run "$__cdist_target_host" "$__cdist_object_self" # cdist-object-gencode-run "$__cdist_target_host" "$__cdist_object_self"
# cdist-object-code-run "$__cdist_target_host" "$__cdist_object_self" # cdist-object-code-run "$__cdist_target_host" "$__cdist_object_self"
for bin in paths: for bin in paths:
if os.path.isfile(bin): FIXME
if mode == "gencode": if os.path.isfile(bin):
self.shell_run_or_debug_fail(manifest, [manifest], env=env) if mode == "gencode":
if mode == "code": self.shell_run_or_debug_fail(manifest, [manifest], env=env)
self.run_or_fail(manifest, [manifest], env=env) if mode == "code":
self.run_or_fail(manifest, [manifest], env=env)
def deploy_to(self): def deploy_to(self):
@ -506,11 +506,8 @@ class Cdist:
# Now do the final steps over the existing objects # Now do the final steps over the existing objects
for cdist_object in objects: for cdist_object in objects:
object_run(cdist_object, mode="gencode") self.object_run(cdist_object, mode="gencode")
object_run(cdist_object, mode="code") self.object_run(cdist_object, mode="code")
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser(description='cdist ' + VERSION) parser = argparse.ArgumentParser(description='cdist ' + VERSION)