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 <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2017-02-06 16:22:42 +08:00
parent 21cdcfcc66
commit d832c0ed56

View File

@ -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)