path: root/openshift-storage-libs
diff options
authorValerii Ponomarov <>2019-05-22 18:01:14 +0530
committervponomar <>2019-05-24 11:14:15 +0000
commitdddf1ceb29e36c799d144d1a34b951af5d10cfb7 (patch)
tree5d2c8d9f48b53ecf0de2f7dcb7c991ad783cd48e /openshift-storage-libs
parent6fbbd5f55db83fdaeff29e80582341b5116b616c (diff)
Make 'command.cmd_run' func be resistable to broken SSH connections
It happens that we get "No ssh connection" errors from time to time. So, avoid such errors recreating SSH connections if such error appears. Change-Id: Idc71c4ceece6b3040c396b25da1deadcefd29b60
Diffstat (limited to 'openshift-storage-libs')
1 files changed, 4 insertions, 0 deletions
diff --git a/openshift-storage-libs/openshiftstoragelibs/ b/openshift-storage-libs/openshiftstoragelibs/
index 0691291..e75bbca 100644
--- a/openshift-storage-libs/openshiftstoragelibs/
+++ b/openshift-storage-libs/openshiftstoragelibs/
@@ -13,6 +13,10 @@ def cmd_run(cmd, hostname, raise_on_error=True):
str: Stripped shell command's stdout value if not None.
ret, out, err =, cmd, "root")
+ if ("no ssh connection" in err.lower() or
+ "tls handshake timeout" in err.lower()):
+ g.ssh_close_connection(hostname)
+ ret, out, err =, cmd, "root")
if raise_on_error:
msg = ("Failed to execute command '%s' on '%s' node. Got non-zero "
"return code '%s'. Err: %s" % (cmd, hostname, ret, err))