From: Kefu Chai Date: Mon, 6 Feb 2017 08:22:42 +0000 (+0800) Subject: ceph: do not throw TypeError on connection failure X-Git-Tag: v12.0.1~480^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=d832c0ed5687e269d3da9d5386e1015f08cd8207;p=ceph-ci.git ceph: do not throw TypeError on connection failure otherwise we could concat None with a string on connection problem. which will result in TypeError. and the caller will print misleading error like Error connecting to cluster: TypeError see also #12934 Signed-off-by: Kefu Chai --- diff --git a/src/ceph.in b/src/ceph.in index c2da5c509d0..0883ccf7637 100755 --- a/src/ceph.in +++ b/src/ceph.in @@ -541,7 +541,10 @@ def ping_monitor(cluster_handle, name, timeout): run_in_thread(cluster_handle.connect, timeout=timeout) for m in monids() : s = run_in_thread(cluster_handle.ping_monitor, m) - print("mon.{0}".format(m) + '\n' + s) + if s is None: + print("mon.{0}".format(m) + '\n' + "Error connecting to monitor.") + else: + print("mon.{0}".format(m) + '\n' + s) else : s = run_in_thread(cluster_handle.ping_monitor, mon_id) print(s)