From 8a8ee5a06d0e54aef47d0e8887c1905e2d0ff308 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Fri, 18 Jul 2025 10:23:31 -0400 Subject: [PATCH] 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 --- src/pybind/mgr/smb/resourcelib.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pybind/mgr/smb/resourcelib.py b/src/pybind/mgr/smb/resourcelib.py index 7128dba26737..d10b26941fa0 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 -- 2.47.3