From 7de51e8d45c43d43ab3f97aec53016562ae47d87 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 12 Sep 2011 10:52:04 +0200 Subject: [PATCH] print help in case no hosts are given Signed-off-by: Nico Schottelius --- bin/cdist | 11 ++++++++--- doc/dev/todo/niconext | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bin/cdist b/bin/cdist index f8500ca7..628cbca4 100755 --- a/bin/cdist +++ b/bin/cdist @@ -616,9 +616,13 @@ if __name__ == "__main__": sys.exit(0) process = {} - time_start = datetime.datetime.now() try: - log.info("Deploying to %s hosts", len(args.host)) + if len(args.host) == 0: + parser.print_help() + sys.exit(1) + + time_start = datetime.datetime.now() + for host in args.host: c = Cdist(host, initial_manifest=args.manifest, home=args.cdist_home) if args.parallel: @@ -635,7 +639,8 @@ if __name__ == "__main__": process[p].join() time_end = datetime.datetime.now() - log.info("Total processing time: %s", (time_end - time_start).total_seconds()) + log.info("Total processing time for %s host(s): %s", len(args.host), + (time_end - time_start).total_seconds()) except KeyboardInterrupt: sys.exit(0) diff --git a/doc/dev/todo/niconext b/doc/dev/todo/niconext index 2b1bb703..ef861cec 100644 --- a/doc/dev/todo/niconext +++ b/doc/dev/todo/niconext @@ -8,6 +8,7 @@ For 2.0.0: - Support parallel execution - and maximum number of parallel runs (-p X) + - error handling / report failed hosts - Support different home instead of ../ - Bug: os.path.join() may be wrong for the remote side! -> does not matter for now!