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-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=65d712f7e1f39859134a6be155a2f72cb52d8e18;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 e760668778ddc8227d0c3aa7baa10ec39bb0b885) --- 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