]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
pybind/mgr/rest: fix "sync_object" API endpoint
authorJohn Spray <john.spray@redhat.com>
Tue, 27 Sep 2016 13:17:26 +0000 (14:17 +0100)
committerJohn Spray <john.spray@redhat.com>
Thu, 29 Sep 2016 16:27:18 +0000 (17:27 +0100)
Signed-off-by: John Spray <john.spray@redhat.com>
src/pybind/mgr/rest/app/types.py
src/pybind/mgr/rest/app/views/v2.py

index 33cdafaed5381fe61417e0c68ff1d7afdc13d602..331c7c941400e1005c026083b942dfb1eacd7bfb 100644 (file)
@@ -235,7 +235,7 @@ class NotFound(Exception):
 
 
 # The objects that ClusterMonitor keeps copies of from the mon
-SYNC_OBJECT_TYPES = [FsMap, OsdMap, MonMap, PgSummary, Health, Config]
+SYNC_OBJECT_TYPES = [FsMap, OsdMap, MonMap, MonStatus, PgSummary, Health, Config]
 SYNC_OBJECT_STR_TYPE = dict((t.str, t) for t in SYNC_OBJECT_TYPES)
 
 USER_REQUEST_COMPLETE = 'complete'
index 2638077807815ce727c71c086337d011d56ccd90..411c3552917f34c907143a1c1c76edc6effca301 100644 (file)
@@ -21,7 +21,7 @@ from rest.app.views.rpc_view import RPCViewSet, DataObject
 from rest.app.types import CRUSH_RULE, POOL, OSD, USER_REQUEST_COMPLETE, \
     USER_REQUEST_SUBMITTED, OSD_IMPLEMENTED_COMMANDS, MON, OSD_MAP, \
     SYNC_OBJECT_TYPES, ServiceId, severity_from_str, SEVERITIES, \
-    OsdMap, Config, MonMap, MonStatus
+    OsdMap, Config, MonMap, MonStatus, SYNC_OBJECT_STR_TYPE
 
 
 from rest.logger import logger
@@ -472,7 +472,11 @@ such as the cluster maps
     """
 
     def retrieve(self, request, sync_type):
-        return Response(self.client.get_sync_object(sync_type))
+        try:
+            sync_type_cls = SYNC_OBJECT_STR_TYPE[sync_type]
+        except KeyError:
+            return Response("Unknown type '{0}'".format(sync_type), status=404)
+        return Response(self.client.get_sync_object(sync_type_cls).data)
 
     def describe(self, request):
         return Response([s.str for s in SYNC_OBJECT_TYPES])