Skip to content

Commit ef84df2

Browse files
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 <[email protected]>
1 parent 657fe40 commit ef84df2

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

src/pybind/mgr/smb/handler.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ def parse(self, txt: str) -> None:
180180
resources.Share,
181181
resources.JoinAuth,
182182
resources.UsersAndGroups,
183+
resources.TLSCredential,
183184
)
184185
}
185186
if txt in rtypes:
@@ -368,20 +369,21 @@ def _search_resources(self, matcher: _Matcher) -> List[SMBResource]:
368369
cluster_id, share_id
369370
).get_share()
370371
)
371-
if resources.JoinAuth in matcher:
372-
log.debug("searching for join auths")
373-
for auth_id in self.join_auth_ids():
374-
if (resources.JoinAuth, auth_id) in matcher:
375-
out.append(self._join_auth_entry(auth_id).get_join_auth())
376-
if resources.UsersAndGroups in matcher:
377-
log.debug("searching for users and groups")
378-
for ug_id in self.user_and_group_ids():
379-
if (resources.UsersAndGroups, ug_id) in matcher:
380-
out.append(
381-
self._users_and_groups_entry(
382-
ug_id
383-
).get_users_and_groups()
384-
)
372+
_resources = (
373+
(resources.JoinAuth, JoinAuthEntry),
374+
(resources.UsersAndGroups, UsersAndGroupsEntry),
375+
(resources.TLSCredential, TLSCredentialEntry),
376+
)
377+
for rtype, ecls in _resources:
378+
if rtype in matcher:
379+
log.debug("searching for %s", cast(Any, rtype).resource_type)
380+
out.extend(
381+
ecls.from_store(
382+
self.internal_store, rid
383+
).get_resource_type(rtype)
384+
for rid in ecls.ids(self.internal_store)
385+
if (rtype, rid) in matcher
386+
)
385387
log.debug("search found %d resources", len(out))
386388
return out
387389

0 commit comments

Comments
 (0)