forked from ungleich-public/cdist
		
	extend run_or_fail to include remote exec
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								b2d1d1bee7
							
						
					
				
			
			
				commit
				
					
						c1ad93bccc
					
				
			
		
					 1 changed files with 2 additions and 8 deletions
				
			
		
							
								
								
									
										10
									
								
								bin/cdist
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								bin/cdist
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -155,20 +155,14 @@ class Cdist:
 | 
			
		|||
         self.exit_error("Non-Zero exit code exit of " + " ".join(*args))
 | 
			
		||||
 | 
			
		||||
   def run_or_fail(self, *args, **kargs):
 | 
			
		||||
      log.debug("Exec: " + " ".join(*args))
 | 
			
		||||
 | 
			
		||||
      if "remote" in kargs:
 | 
			
		||||
         log.debug("Remote found")
 | 
			
		||||
         if kargs["remote"]:
 | 
			
		||||
            # Replace the list found in the tuple at position 0
 | 
			
		||||
            cmd = ["ssh", "root@" + self.target_host]
 | 
			
		||||
            cmd.extend(args[0])
 | 
			
		||||
            args[0] = cmd
 | 
			
		||||
            print(newargs)
 | 
			
		||||
            args[0][:0] = ["ssh", "root@" + self.target_host]
 | 
			
		||||
 | 
			
		||||
         del kargs["remote"]
 | 
			
		||||
 | 
			
		||||
      log.debug(newargs)
 | 
			
		||||
      log.debug("Exec: " + " ".join(*args))
 | 
			
		||||
      try:
 | 
			
		||||
         subprocess.check_call(*args, **kargs)
 | 
			
		||||
      except subprocess.CalledProcessError:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue