]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: API Version changes do not apply to pre-defined methods (list, create... 41675/head
authorAashish Sharma <aashishsharma@localhost.localdomain>
Tue, 1 Jun 2021 05:09:24 +0000 (10:39 +0530)
committerAashish Sharma <aashishsharma@localhost.localdomain>
Thu, 3 Jun 2021 13:03:04 +0000 (18:33 +0530)
Methods like list(), create(), get() etc doesn't get applied the version.Also for the endpoints that get the version changed, the docs and the request header has still the version v1.0+ in them. So with the version reduced it gives 415 error when trying to make the request. This PR fixes this issue.

Fixes: https://tracker.ceph.com/issues/50855
Signed-off-by: Aashish Sharma <aasharma@redhat.com>
(cherry picked from commit dc4becfde8ddf8745b5d63c941236f95d9e64ba3)

Conflicts:
    src/pybind/mgr/dashboard/controllers/__init__.py(resolved conflicts due to https://github.com/ceph/ceph/pull/40063)

src/pybind/mgr/dashboard/controllers/docs.py
src/pybind/mgr/dashboard/tests/test_docs.py

index 87c46e327bd605e1053457ec172f3587581186da..331f2479a69b1d34c0e884c7108c8a04b0bcfb13 100644 (file)
@@ -291,14 +291,14 @@ class Docs(BaseController):
                 resp = {}
                 p_info = []
 
-                if hasattr(func, 'method_map_method'):
-                    version = func.method_map_method['version']
+                if hasattr(func, '__method_map_method__'):
+                    version = func.__method_map_method__['version']
 
-                elif hasattr(func, 'resource_method'):
-                    version = func.resource_method['version']
+                elif hasattr(func, '__resource_method__'):
+                    version = func.__resource_method__['version']
 
-                elif hasattr(func, 'collection_method'):
-                    version = func.collection_method['version']
+                elif hasattr(func, '__collection_method__'):
+                    version = func.__collection_method__['version']
 
                 if hasattr(func, 'doc_info'):
                     if func.doc_info['summary']:
index 623d5baf6efa16058f191e0703ccdca08419c47f..072985e8bf89416420810376cd25419a2f867cdd 100644 (file)
@@ -1,7 +1,6 @@
 # # -*- coding: utf-8 -*-
 from __future__ import absolute_import
 
-from .. import DEFAULT_VERSION
 from ..api.doc import SchemaType
 from ..controllers import ApiController, ControllerDoc, Endpoint, EndpointDoc, RESTController
 from ..controllers.docs import Docs