From d832c0ed5687e269d3da9d5386e1015f08cd8207 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 6 Feb 2017 16:22:42 +0800 Subject: [PATCH] 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 --- src/ceph.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) -- 2.39.5