]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/smb: fix a resource error unpacking str instead of list
authorJohn Mulligan <jmulligan@redhat.com>
Fri, 18 Jul 2025 14:23:31 +0000 (10:23 -0400)
committerAvan Thakkar <athakkar@redhat.com>
Thu, 27 Nov 2025 15:07:27 +0000 (20:37 +0530)
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 <jmulligan@redhat.com>
(cherry picked from commit e760668778ddc8227d0c3aa7baa10ec39bb0b885)

src/pybind/mgr/smb/resourcelib.py

index 7128dba2673769173502b1fdf1981ff23a6c468a..d10b26941fa0e54115bcb89baa36a3ae5f6d50c9 100644 (file)
@@ -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