This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
pespin gerrit-no-reply at lists.osmocom.orgpespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-gsm-tester/+/18659 )
Change subject: process: Improve launch_sync() exception due to process failing
......................................................................
process: Improve launch_sync() exception due to process failing
After this commit, in some situations ssh related errors are printed
directly in the exception to quickly find cause of the issue.
Example:
FAIL: ping.py (5.0 sec) Error: rm-remote-dir(pid=25913): launch_sync(): local ssh process exited with status 255 (ssh: connect to host 10.42.42.110 port 22: No route to host) [trial↪4g:srsue-rftype at zmq+srsenb-rftype@zmq+mod-enb-nprb at 6↪ping.py:9↪ping.py↪srsepc_10.42.42.118↪host-jenkins at 10.42.42.110↪rm-remote-dir(pid=25913)]
Change-Id: Ia16c7dec96f70d761600ad6a50d9df8382d9c2c8
---
M src/osmo_gsm_tester/core/process.py
1 file changed, 17 insertions(+), 1 deletion(-)
Approvals:
Jenkins Builder: Verified
pespin: Looks good to me, approved
diff --git a/src/osmo_gsm_tester/core/process.py b/src/osmo_gsm_tester/core/process.py
index 36ed057..33ae69a 100644
--- a/src/osmo_gsm_tester/core/process.py
+++ b/src/osmo_gsm_tester/core/process.py
@@ -196,7 +196,7 @@
self.terminate()
raise e
if raise_nonsuccess and self.result != 0:
- raise log.Error('Exited in error %d' % self.result)
+ raise self.RunError('launch_sync()')
return self.result
def respawn(self):
@@ -357,6 +357,11 @@
self.process_obj.stdin.write(cmd.encode("utf-8"))
self.process_obj.stdin.flush()
+ def RunError(self, msg_prefix):
+ 'Get a log.Error filled in with Result information. Use when program is terminated and result !=0'
+ msg = '%s: local process exited with status %d' % (msg_prefix, self.result)
+ return log.Error(msg)
+
class RemoteProcess(Process):
def __init__(self, name, run_dir, remote_user, remote_host, remote_cwd, popen_args, remote_env={}, **popen_kwargs):
@@ -382,6 +387,17 @@
' '.join(self.popen_args))]
self.dbg(self.popen_args, dir=self.run_dir, conf=self.popen_kwargs, remote_env=self.remote_env)
+ def RunError(self, msg_prefix):
+ 'Overwrite Process method with ssh extra information'
+ # man ssh states it returns 255 if an ssh error occurred:
+ msg = msg_prefix + ': '
+ if self.result == 255:
+ tail = ' (' + (self.get_stderr_tail(tail=1, prefix='') or '').rstrip() + ')'
+ msg += 'local ssh process exited with status %d%s' % (self.result, tail if 'ssh' in tail else '')
+ else:
+ msg += 'remote process exited with status %d' % (self.result)
+ return log.Error(msg)
+
class NetNSProcess(Process):
NETNS_EXEC_BIN = 'osmo-gsm-tester_netns_exec.sh'
def __init__(self, name, run_dir, netns, popen_args, **popen_kwargs):
--
To view, visit https://gerrit.osmocom.org/c/osmo-gsm-tester/+/18659
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Change-Id: Ia16c7dec96f70d761600ad6a50d9df8382d9c2c8
Gerrit-Change-Number: 18659
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200605/2788d487/attachment.htm>