aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/VatExecutor.py
diff options
context:
space:
mode:
authorPeter Mikus <pmikus@cisco.com>2018-05-09 06:16:31 +0000
committerPeter Mikus <pmikus@cisco.com>2018-05-09 08:39:36 +0000
commit7e20228f4abf509e883093b79bf1f842b092f63b (patch)
tree62651f39dd64c864787ec9d1318314719dd01420 /resources/libraries/python/VatExecutor.py
parent8443891dd9915ed3439b0045c0e47935606d5e61 (diff)
FIX: SSH connect issue
error: [Errno 9] Bad file descriptor Change-Id: I4c5278d41e979f6af43054e3b5890fb154555494 Signed-off-by: Peter Mikus <pmikus@cisco.com>
Diffstat (limited to 'resources/libraries/python/VatExecutor.py')
-rw-r--r--resources/libraries/python/VatExecutor.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/resources/libraries/python/VatExecutor.py b/resources/libraries/python/VatExecutor.py
index d27e0677d3..8c3805c5c3 100644
--- a/resources/libraries/python/VatExecutor.py
+++ b/resources/libraries/python/VatExecutor.py
@@ -204,7 +204,6 @@ class VatTerminal(object):
__LINUX_PROMPT = (":~$ ", "~]$ ", "~]# ")
def __init__(self, node, json_param=True):
- """TODO: Should we document this constructor can raise RuntimeError?"""
json_text = ' json' if json_param else ''
self.json = json_param
self._node = node
@@ -212,7 +211,7 @@ class VatTerminal(object):
self._ssh.connect(self._node)
try:
self._tty = self._ssh.interactive_terminal_open()
- except IOError:
+ except Exception:
raise RuntimeError("Cannot open interactive terminal on node {0}".
format(self._node))
@@ -222,7 +221,7 @@ class VatTerminal(object):
self._tty,
'sudo -S {0}{1}'.format(Constants.VAT_BIN_NAME, json_text),
self.__VAT_PROMPT)
- except IOError:
+ except Exception:
continue
else:
break
@@ -254,9 +253,9 @@ class VatTerminal(object):
"""Execute command on the opened VAT terminal.
:param cmd: Command to be executed.
+
:returns: Command output in python representation of JSON format or
None if not in JSON mode.
- :raise RuntimeError: If VAT command execution fails.
"""
VatHistory.add_to_vat_history(self._node, cmd)
logger.debug("Executing command in VAT terminal: {0}".format(cmd))
@@ -264,7 +263,7 @@ class VatTerminal(object):
out = self._ssh.interactive_terminal_exec_command(self._tty, cmd,
self.__VAT_PROMPT)
self.vat_stdout = out
- except IOError:
+ except Exception:
self._exec_failure = True
vpp_pid = get_vpp_pid(self._node)
if vpp_pid:
@@ -346,4 +345,4 @@ class VatTerminal(object):
for line_tmpl in cmd_template:
vat_cmd = line_tmpl.format(**args)
ret.append(self.vat_terminal_exec_cmd(vat_cmd.replace('\n', '')))
- return ret
+ return ret \ No newline at end of file