]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-rest-api: understand the new style entity_addr_t representation 11686/head
authorKefu Chai <kchai@redhat.com>
Sat, 29 Oct 2016 17:19:06 +0000 (01:19 +0800)
committerKefu Chai <kchai@redhat.com>
Sun, 30 Oct 2016 07:06:44 +0000 (15:06 +0800)
the new entity_addr_t representation was introduced by 3561eb3, we
should update ceph_rest_api.py accordingly.

Fixes: http://tracker.ceph.com/issues/17742
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/pybind/ceph_rest_api.py

index 2dfe6b6140c3705eb3b3a645b11b2f14e0badf53..9bae3ef62a0003f24f6f07310fae2446e6ad818f 100755 (executable)
@@ -111,9 +111,18 @@ def api_setup(app, conf, cluster, clientname, clientid, args):
         app.ceph_baseurl = app.ceph_baseurl[:-1]
     addr = app.ceph_cluster.conf_get('public_addr') or DEFAULT_ADDR
 
-    # remove any nonce from the conf value
-    addr = addr.split('/')[0]
-    addr, port = addr.rsplit(':', 1)
+    if addr == '-':
+        addr = None
+        port = None
+    else:
+        # remove the type prefix from the conf value if any
+        for t in ('legacy:', 'msgr2:'):
+            if addr.startswith(t):
+                addr = addr[len(t):]
+                break
+        # remove any nonce from the conf value
+        addr = addr.split('/')[0]
+        addr, port = addr.rsplit(':', 1)
     addr = addr or DEFAULT_ADDR
     port = port or DEFAULT_PORT
     port = int(port)