enhance cdist-mass-deploy and add parallel execution
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								86a6b10ae9
							
						
					
				
			
			
				commit
				
					
						b9ef12b48d
					
				
			
		
					 1 changed files with 17 additions and 2 deletions
				
			
		| 
						 | 
					@ -22,10 +22,25 @@
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
. cdist-config
 | 
					. cdist-config
 | 
				
			||||||
[ $# -ge 1 ] || __cdist_usage "<target host> [target host ...]"
 | 
					[ $# -ge 1 ] || __cdist_usage "[-p] <target host> [target host ...]"
 | 
				
			||||||
set -eu
 | 
					set -eu
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ "$1" = "-p" ]; then
 | 
				
			||||||
 | 
					   parallel=yes
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					   parallel=""
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
while [ $# -ge 1 ]; do
 | 
					while [ $# -ge 1 ]; do
 | 
				
			||||||
 | 
					   if [ "$parallel" ]; then
 | 
				
			||||||
 | 
					      cdist-deploy-to "$1" &
 | 
				
			||||||
 | 
					   else
 | 
				
			||||||
      cdist-deploy-to "$1"
 | 
					      cdist-deploy-to "$1"
 | 
				
			||||||
 | 
					   fi
 | 
				
			||||||
   shift
 | 
					   shift
 | 
				
			||||||
done
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ "$parallel" ]; then
 | 
				
			||||||
 | 
					   echo "Waiting for cdist-deploy-to jobs to finish..."
 | 
				
			||||||
 | 
					   wait
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue