From d190b192deef9366262ff8fa9607206e8b1dd4ec Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 8 Oct 2011 03:22:19 +0200 Subject: [PATCH 1/5] update timing method Signed-off-by: Nico Schottelius --- bin/cdist | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/bin/cdist b/bin/cdist index 1b8b4346..c42e540c 100755 --- a/bin/cdist +++ b/bin/cdist @@ -21,11 +21,11 @@ # import argparse -import datetime import logging import os import re import sys +import time log = logging.getLogger("cdist") @@ -112,7 +112,7 @@ def configinstall(args, mode): """Configure or install remote system""" process = {} - time_start = datetime.datetime.now() + time_start = time.time() os.environ['__remote_exec'] = "ssh -o User=root -q" os.environ['__remote_copy'] = "scp -o User=root -q" @@ -133,17 +133,15 @@ def configinstall(args, mode): # FIXME: error handling for parallel mode! - time_end = datetime.datetime.now() + time_end = time.time() log.info("Total processing time for %s host(s): %s", len(args.host), - (time_end - time_start).total_seconds()) + (time_end - time_start)) 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) @@ -154,13 +152,6 @@ if __name__ == "__main__": 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: From e10ebeadf89f31bb1b6a85c45e7eb65b1c6aba0a Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 8 Oct 2011 03:24:05 +0200 Subject: [PATCH 2/5] BUGFIX: export global explorer with path from remote Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 3e67f7c1..3544a901 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -24,6 +24,7 @@ import logging import os import stat import sys +import time import cdist.context import cdist.core @@ -230,7 +231,7 @@ class ConfigInstall: output_fd = open(os.path.join(dst_path, explorer), mode='w') cmd = [] cmd.append("__explorer=" + remote_dst_path) - cmd.append(os.path.join(src_path, explorer)) + cmd.append(os.path.join(remote_dst_path, explorer)) cdist.exec.run_or_fail(cmd, stdout=output_fd, remote_prefix=True) output_fd.close() @@ -252,8 +253,11 @@ class ConfigInstall: def deploy_and_cleanup(self): """Do what is most often done: deploy & cleanup""" + start_time = time.time() self.deploy_to() self.cleanup() + log.info("Finished run of %s in %s seconds", + self.target_host, time.time() - start_time) def stage_prepare(self): """Do everything for a deploy, minus the actual code stage""" From ea146c88e7a0cf6f46cb4c6e35f0f3e643d85c17 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 8 Oct 2011 11:59:26 +0200 Subject: [PATCH 3/5] cleanup config Signed-off-by: Nico Schottelius --- lib/cdist/config.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lib/cdist/config.py b/lib/cdist/config.py index 782c88a1..9af25b75 100644 --- a/lib/cdist/config.py +++ b/lib/cdist/config.py @@ -20,14 +20,7 @@ # # -import datetime -import logging -import os -import sys - import cdist.config_install -log = logging.getLogger(__name__) - class Config(cdist.config_install.ConfigInstall): pass From 56e1fc9eb8f47be7139aea1eb1f3e1af3a2be8d5 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 8 Oct 2011 12:01:53 +0200 Subject: [PATCH 4/5] type explorer should run with remote base as well :-) Signed-off-by: Nico Schottelius --- lib/cdist/config_install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cdist/config_install.py b/lib/cdist/config_install.py index 3544a901..e4b51ad4 100644 --- a/lib/cdist/config_install.py +++ b/lib/cdist/config_install.py @@ -195,7 +195,7 @@ class ConfigInstall: self.transfer_object_parameter(cdist_object) for explorer in cdist_type.explorers: - remote_cmd = cmd + [os.path.join(self.context.type_base_path, + remote_cmd = cmd + [os.path.join(self.context.remote_base_path, cdist_type.explorer_path, explorer)] output = os.path.join(self.context.object_base_path, cdist_object.explorer_path, explorer) From 93a312702c207e003032f32e9c6f43db4201567b Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 8 Oct 2011 12:06:45 +0200 Subject: [PATCH 5/5] ++todo(nico) Signed-off-by: Nico Schottelius --- doc/dev/todo/niconext | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 005f1bb0..9710f4ea 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -331,3 +331,4 @@ eof - remote_prefix: scp vs. ssh issue +locale_type