diff --git a/bin/cdist b/bin/cdist index 0bf3ed9c..36dc3d5c 100755 --- a/bin/cdist +++ b/bin/cdist @@ -21,6 +21,7 @@ # import argparse +import datetime import logging import os import re @@ -105,6 +106,8 @@ if __name__ == "__main__": try: logging.basicConfig(format='%(levelname)s: %(message)s') + time_start = datetime.datetime.now() + if re.match(TYPE_PREFIX, os.path.basename(sys.argv[0])): import cdist.emulator cdist.emulator.run(sys.argv) @@ -117,6 +120,14 @@ if __name__ == "__main__": import cdist.path commandline() + + time_end = datetime.datetime.now() + duration = time_end - time_start + # FIXME: move into runner + # log.info("Finished run of %s in %s seconds", self.target_host, + # duration.total_seconds()) + log.info("Finished run in %s seconds", duration.total_seconds()) + except KeyboardInterrupt: sys.exit(0) except cdist.Error as e: diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 3be7e0b1..7d0e2c9a 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -234,22 +234,13 @@ class ConfigInstall: self.object_run(cdist_object, mode="gencode") self.object_run(cdist_object, mode="code") + ### Cleaned / check functions: Round 1 :-) ################################# 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", - self.target_host, - duration.total_seconds()) - - - ### Cleaned / check functions: Round 1 :-) ################################# def deploy_and_cleanup(self): """Do what is most often done: deploy & cleanup""" self.deploy_to()