also catch OSError from subprocess
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
		
					parent
					
						
							
								88c1be4b1b
							
						
					
				
			
			
				commit
				
					
						a9bcec7fbe
					
				
			
		
					 1 changed files with 5 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -198,6 +198,8 @@ class Cdist:
 | 
			
		|||
            script_fd.close()
 | 
			
		||||
 | 
			
		||||
         self.exit_error("Command failed (shell): " + " ".join(*args))
 | 
			
		||||
      except OSError as error:
 | 
			
		||||
         self.exit_error(" ".join(*args) + ": " + error.args[1])
 | 
			
		||||
 | 
			
		||||
   def run_or_fail(self, *args, **kargs):
 | 
			
		||||
      if "remote" in kargs:
 | 
			
		||||
| 
						 | 
				
			
			@ -211,6 +213,9 @@ class Cdist:
 | 
			
		|||
         subprocess.check_call(*args, **kargs)
 | 
			
		||||
      except subprocess.CalledProcessError:
 | 
			
		||||
         self.exit_error("Command failed: " + " ".join(*args))
 | 
			
		||||
      except OSError as error:
 | 
			
		||||
         self.exit_error(" ".join(*args) + ": " + error.args[1])
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
   def remove_remote_dir(self, destination):
 | 
			
		||||
      self.run_or_fail(["rm", "-rf",  destination], remote=True)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue