From: John Mulligan Date: Mon, 2 Mar 2026 21:07:54 +0000 (-0500) Subject: mgr/smb: rename func to map_resource_entry to make it public X-Git-Tag: testing/wip-pdonnell-testing-20260306.175013~26^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=875f6c3dd6cfcf5ed7780bd97ec328d40f6f0ee2;p=ceph-ci.git mgr/smb: rename func to map_resource_entry to make it public Rename the _map_resource_entry to map_resource_entry to make it a public function and enable easier dynamic mapping between smb resource types and their partner entry types. Signed-off-by: John Mulligan --- diff --git a/src/pybind/mgr/smb/internal.py b/src/pybind/mgr/smb/internal.py index 77f4ab4ef96..a954ebc782d 100644 --- a/src/pybind/mgr/smb/internal.py +++ b/src/pybind/mgr/smb/internal.py @@ -238,9 +238,10 @@ class ExternalCephClusterEntry(CommonResourceEntry): return self.get_resource_type(resources.ExternalCephCluster) -def _map_resource_entry( - resource: Union[SMBResource, Type[SMBResource]] +def map_resource_entry( + resource: Union[SMBResource, Type[SMBResource]], ) -> Type[ResourceEntry]: + """Return an entry type class given a resource object or resource class.""" rcls = resource if isinstance(resource, type) else type(resource) _map = { resources.Cluster: ClusterEntry, @@ -262,14 +263,14 @@ def resource_entry( store: ConfigStore, resource: SMBResource ) -> ResourceEntry: """Return a bound store entry object given a resource object.""" - entry_cls = _map_resource_entry(resource) + entry_cls = map_resource_entry(resource) key = entry_cls.to_key(resource) return entry_cls.from_store_by_key(store, key) def resource_key(resource: SMBResource) -> EntryKey: """Return a store entry key for an smb resource object.""" - entry_cls = _map_resource_entry(resource) + entry_cls = map_resource_entry(resource) key = entry_cls.to_key(resource) return str(entry_cls.namespace), str(key)