]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
mgr/smb: fix ceph smb show when a cluster has not associated shares
authorJohn Mulligan <jmulligan@redhat.com>
Wed, 10 Jul 2024 13:50:45 +0000 (09:50 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Wed, 10 Jul 2024 13:55:05 +0000 (09:55 -0400)
commit2119fc9330941d4863fce97356b77acb7635d4b3
treecb90fc7a81b2178758c384a2af2fb8e3e481de4b
parentf25386f7bcbbb7433de5e4d809e6dc601bd7cee8
mgr/smb: fix ceph smb show when a cluster has not associated shares

Fix an error condition in the `ceph smb show` command.  When the ceph
smb show command was run after creating a usersgroups and cluster
resource but no shares resources the following traceback was seen:

```
Error EINVAL: Traceback (most recent call last):
  File "/usr/share/ceph/mgr/mgr_module.py", line 1910, in
_handle_command
    return CLICommand.COMMANDS[cmd['prefix']].call(self, cmd, inbuf)
  File "/usr/share/ceph/mgr/mgr_module.py", line 507, in call
    return self.func(mgr, **kwargs)
  File "/usr/share/ceph/mgr/object_format.py", line 592, in
_format_response
    robj = f(*args, **kwargs)
  File "/usr/share/ceph/mgr/smb/module.py", line 258, in show
    resources = self._handler.matching_resources(resource_names)
  File "/usr/share/ceph/mgr/smb/handler.py", line 403, in
matching_resources
    return self._search_resources(matcher)
  File "/usr/share/ceph/mgr/smb/handler.py", line 414, in
_search_resources
    for share_id in cluster_shares[cluster_id]:
KeyError: 'smbcluster'
```

Fixes: a5cde6ebe940
Reported-by: Anoop C S <anoopcs@cryptolab.net>
Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/pybind/mgr/smb/handler.py
src/pybind/mgr/smb/tests/test_smb.py