print help in case no hosts are given

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-09-12 10:52:04 +02:00
parent 25190e86a3
commit 7de51e8d45
2 changed files with 9 additions and 3 deletions

View file

@ -616,9 +616,13 @@ if __name__ == "__main__":
sys.exit(0) sys.exit(0)
process = {} process = {}
time_start = datetime.datetime.now()
try: 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: for host in args.host:
c = Cdist(host, initial_manifest=args.manifest, home=args.cdist_home) c = Cdist(host, initial_manifest=args.manifest, home=args.cdist_home)
if args.parallel: if args.parallel:
@ -635,7 +639,8 @@ if __name__ == "__main__":
process[p].join() process[p].join()
time_end = datetime.datetime.now() 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: except KeyboardInterrupt:
sys.exit(0) sys.exit(0)

View file

@ -8,6 +8,7 @@ For 2.0.0:
- Support parallel execution - Support parallel execution
- and maximum number of parallel runs (-p X) - and maximum number of parallel runs (-p X)
- error handling / report failed hosts
- Support different home instead of ../ - Support different home instead of ../
- Bug: os.path.join() may be wrong for the remote side! - Bug: os.path.join() may be wrong for the remote side!
-> does not matter for now! -> does not matter for now!