Fix getting len() attr from boolean values

Address the issue by ensuring that the boolean value of extra
specs or metadata being read are from string type. If they are
not, we convert them before getting the length.

Closes-Bug: #2004165
Change-Id: I96c7a6bf862ad81ed756f16f0c398ce68bcf5e66
This commit is contained in:
silvacarloss 2023-01-30 11:37:22 -03:00
parent c5184b28fc
commit 4f66162e3a
2 changed files with 7 additions and 0 deletions

View File

@ -86,6 +86,7 @@ def metadata_to_str(metadata, meta_visible_limit=4, text_length_limit=25):
if len(k) > text_length_limit:
k_shortenned = k[:text_length_limit] + '...'
v = metadata[k]
v = v if isinstance(v, str) else str(v)
if len(v) > text_length_limit:
v = v[:text_length_limit] + '...'
meta.append("%s = %s" % (html_escape(k_shortenned), html_escape(v)))

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Fixed an issue while trying to load share types that had boolean extra
specs when RBAC was enabled. For more details, please refer to
`Launchpad bug <https://bugs.launchpad.net/manila-ui/+bug/2004165>`_