mirror of
				https://github.com/ARM-software/devlib.git
				synced 2025-11-03 23:41:21 +00:00 
			
		
		
		
	utils/ssh: Remove original traceback from exception
In Python 3 when re-raising an exception the original traceback will also be included. In the `_scp` method we do not want to expose the password so hide the original exception when re-raising.
This commit is contained in:
		@@ -27,6 +27,7 @@ import sys
 | 
				
			|||||||
import time
 | 
					import time
 | 
				
			||||||
import atexit
 | 
					import atexit
 | 
				
			||||||
from pipes import quote
 | 
					from pipes import quote
 | 
				
			||||||
 | 
					from future.utils import raise_from
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# pylint: disable=import-error,wrong-import-position,ungrouped-imports,wrong-import-order
 | 
					# pylint: disable=import-error,wrong-import-position,ungrouped-imports,wrong-import-order
 | 
				
			||||||
import pexpect
 | 
					import pexpect
 | 
				
			||||||
@@ -315,8 +316,8 @@ class SshConnection(object):
 | 
				
			|||||||
        try:
 | 
					        try:
 | 
				
			||||||
            check_output(command, timeout=timeout, shell=True)
 | 
					            check_output(command, timeout=timeout, shell=True)
 | 
				
			||||||
        except subprocess.CalledProcessError as e:
 | 
					        except subprocess.CalledProcessError as e:
 | 
				
			||||||
            raise HostError("Failed to copy file with '{}'. Output:\n{}".format(
 | 
					            raise_from(HostError("Failed to copy file with '{}'. Output:\n{}".format(
 | 
				
			||||||
                command_redacted, e.output))
 | 
					                command_redacted, e.output)), None)
 | 
				
			||||||
        except TimeoutError as e:
 | 
					        except TimeoutError as e:
 | 
				
			||||||
            raise TimeoutError(command_redacted, e.output)
 | 
					            raise TimeoutError(command_redacted, e.output)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user