forked from ungleich-public/cdist
		
	Merge branch 'initial-manifest-from-stdin' into __cron
This commit is contained in:
		
				commit
				
					
						b8435b2fd2
					
				
			
		
					 1 changed files with 12 additions and 1 deletions
				
			
		
							
								
								
									
										13
									
								
								bin/cdist
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								bin/cdist
									
										
									
									
									
								
							|  | @ -60,7 +60,7 @@ def commandline(): | |||
|          help='Change cdist home (default: .. from bin directory)', | ||||
|          action='store') | ||||
|     parser['configinstall'].add_argument('-i', '--initial-manifest',  | ||||
|          help='Path to a cdist manifest', | ||||
|          help='Path to a cdist manifest or \'-\' to read from stdin.', | ||||
|          dest='manifest', required=False) | ||||
|     parser['configinstall'].add_argument('-p', '--parallel', | ||||
|          help='Operate on multiple hosts in parallel', | ||||
|  | @ -104,6 +104,17 @@ def configinstall(args, mode): | |||
|     import multiprocessing | ||||
|     import time | ||||
| 
 | ||||
|     initial_manifest_tempfile = None | ||||
|     if args.manifest == '-': | ||||
|         # read initial manifest from stdin | ||||
|         import tempfile | ||||
|         handle, initial_manifest_temp_path = tempfile.mkstemp(prefix='cdist.stdin.') | ||||
|         with os.fdopen(handle, 'w') as fd: | ||||
|             fd.write(sys.stdin.read()) | ||||
|         args.manifest = initial_manifest_temp_path | ||||
|         import atexit | ||||
|         atexit.register(lambda: os.remove(initial_manifest_temp_path)) | ||||
| 
 | ||||
|     try: | ||||
|         process = {} | ||||
|         failed_hosts = [] | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue