X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2Fssh.py;h=cee35868e4f0c389169ad4f6f3f8ddb2d993f982;hp=e4ac93fb1b3356539b56c3782dbe409f7cfaf30e;hb=33fb34665214bbbd0a4b3154169b21c2da01f69b;hpb=ccfe499e2a27f2caf234ecbb2ec948120810eab6 diff --git a/resources/libraries/python/ssh.py b/resources/libraries/python/ssh.py index e4ac93fb1b..cee35868e4 100644 --- a/resources/libraries/python/ssh.py +++ b/resources/libraries/python/ssh.py @@ -24,31 +24,13 @@ from robot.api import logger from scp import SCPClient, SCPException from resources.libraries.python.OptionString import OptionString +from resources.libraries.python.PythonThree import raise_from __all__ = ["exec_cmd", "exec_cmd_no_error"] # TODO: load priv key -def raise_from(raising, excepted): - """Function to be replaced by "raise from" in Python 3. - - Neither "six" nor "future" offer good enough implementation right now. - chezsoi.org/lucas/blog/displaying-chained-exceptions-stacktraces-in-python-2 - - Current implementation just logs excepted error, and raises the new one. - - :param raising: The exception to raise. - :param excepted: The exception we excepted and want to log. - :type raising: BaseException - :type excepted: BaseException - :raises: raising - """ - logger.error("Excepted: {exc!r}\nRaising: {rai!r}".format( - exc=excepted, rai=raising)) - raise raising - - class SSHTimeout(Exception): """This exception is raised when a timeout occurs.""" pass