print help in case no hosts are given
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								25190e86a3
							
						
					
				
			
			
				commit
				
					
						7de51e8d45
					
				
			
		
					 2 changed files with 9 additions and 3 deletions
				
			
		
							
								
								
									
										11
									
								
								bin/cdist
									
										
									
									
									
								
							
							
						
						
									
										11
									
								
								bin/cdist
									
										
									
									
									
								
							| 
						 | 
					@ -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)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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!
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue