From 5f318d5de307a5bb36fd036514c1e88209277146 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 5 Jul 2013 15:12:49 +0200 Subject: [PATCH] print warning in case dry run is activated Signed-off-by: Nico Schottelius --- cdist/config_install.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/cdist/config_install.py b/cdist/config_install.py index 9b732d23..21b01a84 100644 --- a/cdist/config_install.py +++ b/cdist/config_install.py @@ -144,11 +144,6 @@ class ConfigInstall(object): def object_run(self, cdist_object, dry_run=False): """Run gencode and code for an object""" - if self.dry_run: - dry_run = "" - else: - dry_run = " (dry run)" - self.log.debug("Trying to run object %s" % (cdist_object.name)) if cdist_object.state == core.CdistObject.STATE_DONE: raise cdist.Error("Attempting to run an already finished object: %s", cdist_object) @@ -156,19 +151,22 @@ class ConfigInstall(object): cdist_type = cdist_object.cdist_type # Generate - self.log.info("Generating and executing code for %s%s" % (cdist_object.name, dry_run)) + self.log.info("Generating and executing code for %s" % (cdist_object.name)) cdist_object.code_local = self.code.run_gencode_local(cdist_object) cdist_object.code_remote = self.code.run_gencode_remote(cdist_object) if cdist_object.code_local or cdist_object.code_remote: cdist_object.changed = True # Execute - if not dry_run: + if not self.dry_run: if cdist_object.code_local: self.code.run_code_local(cdist_object) if cdist_object.code_remote: self.code.transfer_code_remote(cdist_object) self.code.run_code_remote(cdist_object) + else: + self.log.info("Skipping code execution due to DRY RUN") + # Mark this object as done self.log.debug("Finishing run of " + cdist_object.name)