]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph: do not throw TypeError on connection failure 13268/head
authorKefu Chai <kchai@redhat.com>
Mon, 6 Feb 2017 08:22:42 +0000 (16:22 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 6 Feb 2017 08:30:36 +0000 (16:30 +0800)
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>
src/ceph.in

index c2da5c509d0bdbc638dbbf96335620d4737670b5..0883ccf763772dd9880980485c5ace496750e223 100755 (executable)
@@ -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)