From 1665b4b5e651b392b91c1a946180117a9cd61eca Mon Sep 17 00:00:00 2001 From: Steven Armstrong Date: Thu, 13 Oct 2011 14:32:52 +0200 Subject: [PATCH] implement run_gencode_remote Signed-off-by: Steven Armstrong --- lib/cdist/core/code.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/cdist/core/code.py b/lib/cdist/core/code.py index de735cb4..a6804c0b 100644 --- a/lib/cdist/core/code.py +++ b/lib/cdist/core/code.py @@ -100,11 +100,18 @@ class Code(object): '__object_fq': cdist_object.path, } - def run_gencode_local(self, cdist_object): + def _run_gencode(self, cdist_object, which): 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.update(self.env) env.update(self._get_env_for_object(cdist_object)) 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')