implement run_gencode_remote

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
Steven Armstrong 2011-10-13 14:32:52 +02:00
parent 6d438d4ec5
commit 1665b4b5e6

View file

@ -100,11 +100,18 @@ class Code(object):
'__object_fq': cdist_object.path, '__object_fq': cdist_object.path,
} }
def run_gencode_local(self, cdist_object): def _run_gencode(self, cdist_object, which):
cdist_type = cdist_object.type cdist_type = cdist_object.type
script = os.path.join(self.local.type_path, cdist_type.gencode_local_path) script = os.path.join(self.local.type_path, getattr(cdist_type, 'gencode_%s_path' % which))
env = os.environ.copy() env = os.environ.copy()
env.update(self.env) env.update(self.env)
env.update(self._get_env_for_object(cdist_object)) env.update(self._get_env_for_object(cdist_object))
return self.local.run_script(script, env=env) return self.local.run_script(script, env=env)
def run_gencode_local(self, cdist_object):
"""Run the gencode-local script for the given cdist object."""
return self._run_gencode(cdist_object, 'local')
def run_gencode_remote(self, cdist_object):
"""Run the gencode-remote script for the given cdist object."""
return self._run_gencode(cdist_object, 'remote')