From 28522a59f34eddb808db650ab74bc3bf4337db0f Mon Sep 17 00:00:00 2001 From: Callum Dickinson Date: Tue, 21 Jan 2025 14:53:50 +1300 Subject: [PATCH] Increase string attribute max length to 256 chars Increase the maximum supported length for string type resource attributes from 255 to 256 characters, to allow creating string attributes on resources that accept values of such length (e.g. Swift container names). --- gnocchi/resource_type.py | 6 +++--- gnocchi/tests/functional/gabbits/resource-type.yaml | 4 ++-- .../notes/string-attribute-max-length-33e037494a0e318c.yaml | 6 ++++++ 3 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 releasenotes/notes/string-attribute-max-length-33e037494a0e318c.yaml diff --git a/gnocchi/resource_type.py b/gnocchi/resource_type.py index e46206ff7..203fa53d1 100644 --- a/gnocchi/resource_type.py +++ b/gnocchi/resource_type.py @@ -141,9 +141,9 @@ def __init__(self, min_length, max_length, *args, **kwargs): meta_schema_ext = { voluptuous.Required('min_length', default=0): - voluptuous.All(int, voluptuous.Range(min=0, max=255)), - voluptuous.Required('max_length', default=255): - voluptuous.All(int, voluptuous.Range(min=1, max=255)) + voluptuous.All(int, voluptuous.Range(min=0, max=256)), + voluptuous.Required('max_length', default=256): + voluptuous.All(int, voluptuous.Range(min=1, max=256)) } @property diff --git a/gnocchi/tests/functional/gabbits/resource-type.yaml b/gnocchi/tests/functional/gabbits/resource-type.yaml index b8eb0b47a..719665fd4 100644 --- a/gnocchi/tests/functional/gabbits/resource-type.yaml +++ b/gnocchi/tests/functional/gabbits/resource-type.yaml @@ -146,7 +146,7 @@ tests: foobar: type: string required: False - max_length: 255 + max_length: 256 min_length: 0 uuid: type: uuid @@ -200,7 +200,7 @@ tests: type: string required: False min_length: 0 - max_length: 255 + max_length: 256 uuid: type: uuid required: True diff --git a/releasenotes/notes/string-attribute-max-length-33e037494a0e318c.yaml b/releasenotes/notes/string-attribute-max-length-33e037494a0e318c.yaml new file mode 100644 index 000000000..50a966b7e --- /dev/null +++ b/releasenotes/notes/string-attribute-max-length-33e037494a0e318c.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + The maximum allowed length for string-type resource attributes has been + increased from 255 to 256 characters. This allows creating attributes + that accept values up to 256 characters long e.g. Swift container names.