aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/VatExecutor.py
diff options
context:
space:
mode:
authorVratko Polak <vrpolak@cisco.com>2018-04-26 15:15:51 +0200
committerPeter Mikus <pmikus@cisco.com>2018-05-04 09:35:22 +0000
commit5e7be479eacd4d1085cab152c35dcb6433a146ed (patch)
tree0d91e7ae63856c3d3d4588654abfd6ed8fa8a76a /resources/libraries/python/VatExecutor.py
parentceb7c2545cda1bc7fe3d4bf35cdf75253efe8c6d (diff)
Fix various pylint 1.5.4 warnings
+ DUTSetup.py:424 Else clause on loop without a break statement + InterfaceUtil.py:400 Else clause on loop without a break statement + QemuUtils.py:564 Wrong continued indentation + SetupDPDKTest.py: Locally enabling broad-except + VatExecutor.py: Catching too general exception Exception + ssh.py:95 No exception type(s) specified. + HTTPRequest.py: Tolerate HTTPCodes.OK + multiple: Drop ":returns: None" from docstrings. There are still several warnings present: - R0902(too-many-instance-attributes) - R0912(too-many-branches) - R0913(too-many-arguments) - R0914(too-many-locals) - R0915(too-many-statements) - R0401(cyclic-import) And there are multiple blocks of similar lines, mainly across various Setup*Test.py files: - R0801(duplicate-code) Change-Id: I582575cb52b85d69d268e6374852f6e74bb71052 Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Diffstat (limited to 'resources/libraries/python/VatExecutor.py')
-rw-r--r--resources/libraries/python/VatExecutor.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/resources/libraries/python/VatExecutor.py b/resources/libraries/python/VatExecutor.py
index 41e97e3901..d27e0677d3 100644
--- a/resources/libraries/python/VatExecutor.py
+++ b/resources/libraries/python/VatExecutor.py
@@ -204,6 +204,7 @@ 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
@@ -211,7 +212,7 @@ class VatTerminal(object):
self._ssh.connect(self._node)
try:
self._tty = self._ssh.interactive_terminal_open()
- except Exception:
+ except IOError:
raise RuntimeError("Cannot open interactive terminal on node {0}".
format(self._node))
@@ -221,7 +222,7 @@ class VatTerminal(object):
self._tty,
'sudo -S {0}{1}'.format(Constants.VAT_BIN_NAME, json_text),
self.__VAT_PROMPT)
- except Exception:
+ except IOError:
continue
else:
break
@@ -253,9 +254,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))
@@ -263,7 +264,7 @@ class VatTerminal(object):
out = self._ssh.interactive_terminal_exec_command(self._tty, cmd,
self.__VAT_PROMPT)
self.vat_stdout = out
- except Exception:
+ except IOError:
self._exec_failure = True
vpp_pid = get_vpp_pid(self._node)
if vpp_pid: