]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: docs gen tags sort 48032/head
authorPere Diaz Bou <pdiazbou@redhat.com>
Fri, 9 Sep 2022 09:18:42 +0000 (11:18 +0200)
committerPere Diaz Bou <pdiazbou@redhat.com>
Fri, 9 Sep 2022 20:43:01 +0000 (22:43 +0200)
When generating tags the order of endpoints wasn't taken into account.
Two endpoints with the same url prefix, for example `/api/cluster/` and
`/api/cluster/user`, have different docs and the tags is generated from
a doc of one of these two, and since the order of these endpoints might
vary it is imperative to sort them to have a deterministic output.

Signed-off-by: Pere Diaz Bou <pdiazbou@redhat.com>
src/pybind/mgr/dashboard/controllers/docs.py
src/pybind/mgr/dashboard/tox.ini

index d5c71383e340b3b629c217bec3e319c57e037226..2ade4ef9bad4c8c6f392715c46b002f069b34e7f 100644 (file)
@@ -33,7 +33,7 @@ class Docs(BaseController):
                     list_of_ctrl.add(endpoint.ctrl)
 
         tag_map: Dict[str, str] = {}
-        for ctrl in list_of_ctrl:
+        for ctrl in sorted(list_of_ctrl, key=lambda ctrl: ctrl.__name__):
             tag_name = ctrl.__name__
             tag_descr = ""
             if hasattr(ctrl, 'doc_info'):
index f412c0bdf18e9389dfec34a4c467cbf7fffcc663..47756e946e125facafcecb6d2d94917317ff81df 100644 (file)
@@ -30,6 +30,7 @@ deps =
     -rrequirements-lint.txt
 
 [testenv]
+basepython=python3
 deps =
     {[base]deps}
     {[base-test]deps}
@@ -47,7 +48,6 @@ commands =
     pytest {posargs}
 
 [testenv:run]
-basepython=python3
 deps =
     {[base]deps}
     {[base-test]deps}
@@ -99,7 +99,6 @@ commands =
     rstcheck --report info --debug -- {[rstlint]dirs}
 
 [testenv:lint]
-basepython=python3
 deps =
     {[base]deps}
     {[base-lint]deps}
@@ -112,13 +111,11 @@ commands =
     {[base-rst]commands}
 
 [testenv:flake8]
-basepython = python3
 deps = {[base-lint]deps}
 commands =
     flake8 --config=tox.ini {posargs}
 
 [testenv:pylint]
-basepython = python3
 deps =
     {[base]deps}
     {[base-lint]deps}
@@ -126,7 +123,6 @@ commands =
     pylint {[pylint]addopts} {posargs:{[pylint]dirs}}
 
 [testenv:rst]
-basepython = python3
 deps = {[base-lint]deps}
 commands =
     rstcheck --report info --debug -- {posargs:{[rstlint]dirs}}
@@ -142,7 +138,6 @@ addopts =
 #    --aggressive
 
 [testenv:fix]
-basepython=python3
 deps =
     {[base-lint]deps}
 commands =
@@ -156,7 +151,6 @@ commands =
     python ci/check_grafana_dashboards.py frontend/src/app ../../../../monitoring/ceph-mixin/dashboards_out
 
 [testenv:openapi-{check,fix}]
-basepython = python3
 allowlist_externals = diff
 description =
     check: Ensure that auto-generated OpenAPI Specification matches the current version