X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2Fssh.py;h=90ac0be2dc2d5ad830514272dddfeb73799ddb42;hp=8acb54b3824f7dfed8c50e6d7c2d3abe832de272;hb=cf561a6e3d4c4fbd78ab6c9d0a9aa817bb3300fc;hpb=145e2101dc39a701286bc51ddaa0dbd1a4cf022f diff --git a/resources/libraries/python/ssh.py b/resources/libraries/python/ssh.py index 8acb54b382..90ac0be2dc 100644 --- a/resources/libraries/python/ssh.py +++ b/resources/libraries/python/ssh.py @@ -195,7 +195,7 @@ class SSH(object): command = 'sudo -S {c} <<< "{i}"'.format(c=cmd, i=cmd_input) return self.exec_command(command, timeout) - def interactive_terminal_open(self, time_out=10): + def interactive_terminal_open(self, time_out=30): """Open interactive terminal on a new channel on the connected Node. :param time_out: Timeout in seconds. @@ -228,8 +228,7 @@ class SSH(object): raise Exception('Socket timeout: {0}'.format(buf)) return chan - def interactive_terminal_exec_command(self, chan, cmd, prompt, - time_out=30): + def interactive_terminal_exec_command(self, chan, cmd, prompt): """Execute command on interactive terminal. interactive_terminal_open() method has to be called first! @@ -238,7 +237,6 @@ class SSH(object): :param cmd: Command to be executed. :param prompt: Command prompt, sequence of characters used to indicate readiness to accept commands. - :param time_out: Timeout in seconds. :return: Command output. .. warning:: Interruptingcow is used here, and it uses @@ -303,7 +301,7 @@ def exec_cmd(node, cmd, timeout=600, sudo=False): ssh = SSH() try: ssh.connect(node) - except Exception as err: + except SSHException as err: logger.error("Failed to connect to node" + str(err)) return None, None, None @@ -313,7 +311,7 @@ def exec_cmd(node, cmd, timeout=600, sudo=False): else: (ret_code, stdout, stderr) = ssh.exec_command_sudo(cmd, timeout=timeout) - except Exception as err: + except SSHException as err: logger.error(err) return None, None, None