From b2546fb236c1608a3d01840992d5330a0959b35f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 16 Sep 2011 13:24:40 +0200 Subject: [PATCH] split deploy to into two stages Signed-off-by: Nico Schottelius --- bin/cdist | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/bin/cdist b/bin/cdist index 49985c01..a4570a34 100755 --- a/bin/cdist +++ b/bin/cdist @@ -555,10 +555,8 @@ class Cdist: self.transfer_file(local_remote_code, remote_remote_code) self.run_or_fail([remote_remote_code], remote=True) - def deploy_to(self): - """Mimic the old deploy to: Deploy to one host""" - log.info("Deploying to " + self.target_host) - time_start = datetime.datetime.now() + def stage_prepare(self): + """Do everything for a deploy, minus the actual code stage""" self.init_deploy() self.run_global_explores() self.run_initial_manifest() @@ -580,14 +578,24 @@ class Cdist: self.objects_prepared.append(cdist_object) objects = self.list_objects() - + + def stage_run(self): + """The final (and real) step of deployment""" log.debug("Actual run objects") # Now do the final steps over the existing objects - for cdist_object in objects: + for cdist_object in self.list_objects(): log.debug("Run object: %s", cdist_object) self.object_run(cdist_object, mode="gencode") self.object_run(cdist_object, mode="code") + def deploy_to(self): + """Mimic the old deploy to: Deploy to one host""" + log.info("Deploying to " + self.target_host) + time_start = datetime.datetime.now() + + self.stage_prepare() + self.stage_run() + time_end = datetime.datetime.now() duration = time_end - time_start log.info("Finished run of %s in %s seconds",