]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/smb: move resource types to class level
authorJohn Mulligan <jmulligan@redhat.com>
Tue, 16 Dec 2025 15:25:58 +0000 (10:25 -0500)
committerJohn Mulligan <jmulligan@redhat.com>
Fri, 13 Feb 2026 16:42:48 +0000 (11:42 -0500)
Move resource types to class level to make these more obvious
for future modifications.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/pybind/mgr/smb/handler.py

index 51189a74e34353ad05a00258259e1b77b877cc65..027931a4c59d68cb383b79a51303d4c3bd890a95 100644 (file)
@@ -146,6 +146,14 @@ class _FakeAuthorizer:
 
 
 class _Matcher:
+    _match_resources = (
+        resources.Cluster,
+        resources.Share,
+        resources.JoinAuth,
+        resources.UsersAndGroups,
+        resources.TLSCredential,
+    )
+
     def __init__(self) -> None:
         self._contents: Set[Any] = set()
         self._inputs: Set[str] = set()
@@ -175,14 +183,7 @@ class _Matcher:
 
     def parse(self, txt: str) -> None:
         rtypes: Dict[str, Any] = {
-            cast(Any, r).resource_type: r
-            for r in (
-                resources.Cluster,
-                resources.Share,
-                resources.JoinAuth,
-                resources.UsersAndGroups,
-                resources.TLSCredential,
-            )
+            cast(Any, r).resource_type: r for r in self._match_resources
         }
         if txt in rtypes:
             resource_cls = rtypes[txt]