]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/smb: rename func to map_resource_entry to make it public
authorJohn Mulligan <jmulligan@redhat.com>
Mon, 2 Mar 2026 21:07:54 +0000 (16:07 -0500)
committerJohn Mulligan <jmulligan@redhat.com>
Tue, 3 Mar 2026 15:55:45 +0000 (10:55 -0500)
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 <jmulligan@redhat.com>
src/pybind/mgr/smb/internal.py

index 77f4ab4ef963b73c4323cfdf8a2a0033604aeb62..a954ebc782dea7f351f8f0b68bc3c2d365d61ca3 100644 (file)
@@ -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)