]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
python-common: handle "anonymous_access: false" in to_json of Grafana spec 59457/head
authorAdam King <adking@redhat.com>
Tue, 16 Apr 2024 16:22:01 +0000 (12:22 -0400)
committerAdam King <adking@redhat.com>
Tue, 27 Aug 2024 14:06:39 +0000 (10:06 -0400)
commit517286c8d488ee85ea3d405c20cfe4efddc08ad3
treefda7188e3f41632daac748885f8dce7af9b467d2
parentfe43f1c9f9e2945dda7244d8acbd33fb921449af
python-common: handle "anonymous_access: false" in to_json of Grafana spec

This option is dropped during the regular ServiceSpec to_json
function, as it is not equipped to handle booleans that default
to True. In hindsight, we just shouldn't have added a boolean
field that defaults to True, but it's a bit late now to change
the attribute, so this implements a workaround.

NOTE: if OrderedDict[str, Any] is not encapsulated in quotes,
a bunch of mgr modules fail to load on python 3.6 with

mgr[py] Traceback (most recent call last):
 File "/usr/share/ceph/mgr/volumes/__init__.py", line 2, in <module>
   from .module import Module
 File "/usr/share/ceph/mgr/volumes/module.py", line 7, in <module>
   import orchestrator
 File "/usr/share/ceph/mgr/orchestrator/__init__.py", line 3, in <module>
   from .module import OrchestratorCli
 File "/usr/share/ceph/mgr/orchestrator/module.py", line 19, in <module>
   from ceph.deployment.drive_group import DriveGroupSpec, DeviceSelection, OSDMethod
 File "/lib/python3.6/site-packages/ceph/deployment/drive_group.py", line 5, in <module>
   from ceph.deployment.service_spec import (
 File "/lib/python3.6/site-packages/ceph/deployment/service_spec.py", line 1986, in <module>
   class GrafanaSpec(MonitoringSpec):
 File "/lib/python3.6/site-packages/ceph/deployment/service_spec.py", line 2034, in GrafanaSpec
   def to_json(self) -> OrderedDict[str, Any]:
TypeError: 'type' object is not subscriptable

Fixes: https://tracker.ceph.com/issues/65511
Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit 0089536567b2ce8d3215339b264a48de06bfac38)
src/python-common/ceph/deployment/service_spec.py
src/python-common/ceph/tests/test_service_spec.py