From 06b4b32d2081a9778dbd1f64c57476e088460816 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Douglas=20Mendiz=C3=A1bal?= Date: Wed, 10 Nov 2021 15:19:07 -0600 Subject: [PATCH] Fix consumer name length validator This patch fixes a mismatch between the size of the column for a consumer "name" in the database and the value being checked by the api validator. The maximum size in the database is 36 chars [1], so we must use that value in the validator. [1] https://opendev.org/openstack/barbican/src/branch/stable/xena/barbican/model/models.py#L826 Story: 2009672 Task: 43933 Change-Id: I76f075a94056aa65cd44fd1d7f5d4b24109b6ed1 (cherry picked from commit 31aa926175b62b347593acb8b147810b4b49b9de) (cherry picked from commit 059b4a080a40553dbba02b0f838cc33cacf5d44b) (cherry picked from commit c1204779b2802c5f1029b4bfed370414a610602f) --- barbican/common/validators.py | 4 ++-- releasenotes/notes/fix-story-2009672-d64ef6c10444f517.yaml | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 releasenotes/notes/fix-story-2009672-d64ef6c10444f517.yaml diff --git a/barbican/common/validators.py b/barbican/common/validators.py index 7984b9c49..b9c538c2f 100644 --- a/barbican/common/validators.py +++ b/barbican/common/validators.py @@ -730,8 +730,8 @@ class ContainerConsumerValidator(ValidatorBase): self.schema = { "type": "object", "properties": { - "URL": {"type": "string", "minLength": 1}, - "name": {"type": "string", "maxLength": 255, "minLength": 1} + "URL": {"type": "string", "maxLength": 255, "minLength": 1}, + "name": {"type": "string", "maxLength": 36, "minLength": 1} }, "required": ["name", "URL"] } diff --git a/releasenotes/notes/fix-story-2009672-d64ef6c10444f517.yaml b/releasenotes/notes/fix-story-2009672-d64ef6c10444f517.yaml new file mode 100644 index 000000000..2503aa0b6 --- /dev/null +++ b/releasenotes/notes/fix-story-2009672-d64ef6c10444f517.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Fixed Story #2009672 - Fixed validator for Container Consumers to prevent + 500 errors.