From 07460610f8de0c6d224a0a3dea8d9ead63c61bcc Mon Sep 17 00:00:00 2001 From: Eric Fried Date: Thu, 21 Jun 2018 09:16:17 -0500 Subject: [PATCH] placement: s/None/null/ in consumer conflict msg The placement API had a message complaining that it was "expecting None" which is python-speak when it should be JSON speak. This change corrects the message and adds a gabbi test for it. Change-Id: Ibfb3d581588c8eb954a9faca19d9cb26d2c28861 Closes-Bug: #1778071 --- nova/api/openstack/placement/util.py | 2 +- .../placement/gabbits/allocations-1.28.yaml | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/nova/api/openstack/placement/util.py b/nova/api/openstack/placement/util.py index e7185a0a86ad..f20eeef19cf4 100644 --- a/nova/api/openstack/placement/util.py +++ b/nova/api/openstack/placement/util.py @@ -640,7 +640,7 @@ def ensure_consumer(ctx, consumer_uuid, project_id, user_id, if consumer_generation is not None: raise webob.exc.HTTPConflict( _('consumer generation conflict - ' - 'expected None but got %s') % consumer_generation) + 'expected null but got %s') % consumer_generation) # No such consumer. This is common for new allocations. Create the # consumer record try: diff --git a/nova/tests/functional/api/openstack/placement/gabbits/allocations-1.28.yaml b/nova/tests/functional/api/openstack/placement/gabbits/allocations-1.28.yaml index 839ef270835d..c1e356c7da83 100644 --- a/nova/tests/functional/api/openstack/placement/gabbits/allocations-1.28.yaml +++ b/nova/tests/functional/api/openstack/placement/gabbits/allocations-1.28.yaml @@ -50,6 +50,21 @@ tests: response_strings: - JSON does not validate +- name: new version gen is not null no existing + PUT: /allocations/22222222-2222-2222-2222-222222222222 + data: + allocations: + $ENVIRON['RP_UUID']: + resources: + DISK_GB: 10 + project_id: $ENVIRON['PROJECT_ID'] + user_id: $ENVIRON['USER_ID'] + consumer_generation: 5 + status: 409 + response_strings: + - consumer generation conflict + - expected null but got 5 + - name: new version gen is None no existing PUT: /allocations/22222222-2222-2222-2222-222222222222 data: