diff --git a/placement/schemas/allocation.py b/placement/schemas/allocation.py index bdf93795f..b4daac684 100644 --- a/placement/schemas/allocation.py +++ b/placement/schemas/allocation.py @@ -172,7 +172,7 @@ POST_ALLOCATIONS_V1_28["patternProperties"] = { # request group suffixes with lists of resource provider uuids. mappings_schema = { "type": "object", - "minProperites": 1, + "minProperties": 1, "patternProperties": { common.GROUP_PAT_1_33: { "type": "array", diff --git a/placement/tests/functional/gabbits/allocations-mappings.yaml b/placement/tests/functional/gabbits/allocations-mappings.yaml index cd112a05f..6583c0109 100644 --- a/placement/tests/functional/gabbits/allocations-mappings.yaml +++ b/placement/tests/functional/gabbits/allocations-mappings.yaml @@ -70,8 +70,19 @@ tests: project_id: b2e599e0-ded8-47fd-b8ab-ceb7fca578bd status: 400 response_json_paths: - # u? accounts for difference in Python 2.7 v. 3.x response - $.errors[0].detail: "/JSON does not validate: u?'beta' is not of type 'array'/" + $.errors[0].detail: "/JSON does not validate: 'beta' is not of type 'array'/" + +- name: put allocation mapping empty + PUT: /allocations/5f9588de-079d-462a-a459-408524ab9b60 + data: + allocations: $HISTORY['mappings request'].$RESPONSE['$.allocation_requests[0].allocations'] + mappings: {} + consumer_generation: null + user_id: 8c974f9a-f266-42f7-8613-a8017cbfb87F + project_id: b2e599e0-ded8-47fd-b8ab-ceb7fca578bd + status: 400 + response_json_paths: + $.errors[0].detail: "/JSON does not validate: {} does not have enough properties/" - name: post allocation with results POST: /allocations diff --git a/releasenotes/notes/create-allocation-empty-mapping-field-f5f97de6df891362.yaml b/releasenotes/notes/create-allocation-empty-mapping-field-f5f97de6df891362.yaml new file mode 100644 index 000000000..17fee7ed4 --- /dev/null +++ b/releasenotes/notes/create-allocation-empty-mapping-field-f5f97de6df891362.yaml @@ -0,0 +1,9 @@ +--- +fixes: + - | + Since microversion 1.34, it has been possible to provide a ``mappings`` + field when creating new allocations via the ``POST /allocations`` or ``PUT + /allocations/{allocation_id}`` APIs. This field should be a a dictionary + associating request group suffixes with a list of UUIDs identifying the + resource providers that satisfied each group. Due to a typo, this was + allowing an empty object (``{}``). This is now corrected.