From 5e13a045a3799a01d82061451479022700d7d9fd Mon Sep 17 00:00:00 2001 From: Volker Eckert Date: Wed, 7 Nov 2018 20:17:48 +0000 Subject: [PATCH] utils/ssh.py: try to make failure to parse response more obvious --- devlib/utils/ssh.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/devlib/utils/ssh.py b/devlib/utils/ssh.py index e493ffb..bdd4345 100644 --- a/devlib/utils/ssh.py +++ b/devlib/utils/ssh.py @@ -205,9 +205,13 @@ class SshConnection(object): try: with self.lock: _command = '({}); __devlib_ec=$?; echo; echo $__devlib_ec'.format(command) - raw_output = self._execute_and_wait_for_prompt( - _command, timeout, as_root, strip_colors) - output, exit_code_text, _ = raw_output.rsplit('\r\n', 2) + full_output = self._execute_and_wait_for_prompt(_command, timeout, as_root, strip_colors) + split_output = full_output.rsplit('\r\n', 2) + try: + output, exit_code_text, _ = split_output + except ValueError as e: + raise TargetStableError( + "cannot split reply (target misconfiguration?):\n'{}'".format(full_output)) if check_exit_code: try: exit_code = int(exit_code_text)