From: John Mulligan Date: Fri, 18 Jul 2025 14:23:31 +0000 (-0400) Subject: mgr/smb: fix a resource error unpacking str instead of list X-Git-Tag: testing/wip-pdonnell-testing-20260323.122957-tentacle~636 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e44b7bf7a1bdf8dd3f32c2c12d8946817c36a6b9;p=ceph-ci.git mgr/smb: fix a resource error unpacking str instead of list Add special handling for the case where a string is passed instead of a list. Without this fix a string will be converted into a list of single letter items, something pretty much no one ever wants. Raise an exception instead. Signed-off-by: John Mulligan (cherry picked from commit 72017e1224ff731d59c00fe15e1f87b7cb875d21) --- diff --git a/src/pybind/mgr/smb/resourcelib.py b/src/pybind/mgr/smb/resourcelib.py index 7128dba2673..d10b26941fa 100644 --- a/src/pybind/mgr/smb/resourcelib.py +++ b/src/pybind/mgr/smb/resourcelib.py @@ -390,6 +390,10 @@ class Resource: return _fs(value) if fld.takes(list): + if isinstance(value, str): + raise ResourceTypeError( + f'{fld.name} expects a list not a string' + ) subtype = fld.list_element_type() return [ self._object_sub_from_simplified(subtype, v) for v in value