From c7da235ece91be4b32b211360207316c38377aa9 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Tue, 1 Jul 2025 17:44:01 -0400 Subject: [PATCH] mgr/smb: make tls credential types work in smb show Update the handler code needed to make tls credential types work corrently for `ceph smb show` commands. Signed-off-by: John Mulligan (cherry picked from commit ef84df2f45f359ec1a9f26610a9fb5d936d54dbd) --- src/pybind/mgr/smb/handler.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/pybind/mgr/smb/handler.py b/src/pybind/mgr/smb/handler.py index 840ec24a6f4b7..8e7fe3c76f200 100644 --- a/src/pybind/mgr/smb/handler.py +++ b/src/pybind/mgr/smb/handler.py @@ -180,6 +180,7 @@ class _Matcher: resources.Share, resources.JoinAuth, resources.UsersAndGroups, + resources.TLSCredential, ) } if txt in rtypes: @@ -368,20 +369,21 @@ class ClusterConfigHandler: cluster_id, share_id ).get_share() ) - if resources.JoinAuth in matcher: - log.debug("searching for join auths") - for auth_id in self.join_auth_ids(): - if (resources.JoinAuth, auth_id) in matcher: - out.append(self._join_auth_entry(auth_id).get_join_auth()) - if resources.UsersAndGroups in matcher: - log.debug("searching for users and groups") - for ug_id in self.user_and_group_ids(): - if (resources.UsersAndGroups, ug_id) in matcher: - out.append( - self._users_and_groups_entry( - ug_id - ).get_users_and_groups() - ) + _resources = ( + (resources.JoinAuth, JoinAuthEntry), + (resources.UsersAndGroups, UsersAndGroupsEntry), + (resources.TLSCredential, TLSCredentialEntry), + ) + for rtype, ecls in _resources: + if rtype in matcher: + log.debug("searching for %s", cast(Any, rtype).resource_type) + out.extend( + ecls.from_store( + self.internal_store, rid + ).get_resource_type(rtype) + for rid in ecls.ids(self.internal_store) + if (rtype, rid) in matcher + ) log.debug("search found %d resources", len(out)) return out -- 2.39.5