Glance returned 200 status code when we add element to nonexistent property

Bug #1485478 reported by Darja Shakhray
18
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Undecided
Darja Shakhray

Bug Description

ENVIRONMENT: devstack, Glance (master, 14.08.2015)

STEPS TO REPRODUCE:
We tried add/remove/replace element to nonexistent property on artifact.
Send request
curl -H "X-Auth-Token: b582b953413b4a8896bfa27e1b70d4e0" -H "Content-Type:application/json" -X PATCH -d '[{"op": "add", "path": "/banana", "value": "minion_Stuart"}]' http://172.18.76.44:9292/v3/artifacts/myartifact/v2.0/4d1e26e5-87b7-49b4-99bd-0e6232a80142 -i

EXPECTED RESULT:
status code 400 and error description

ACTUAL RESULT:
HTTP/1.1 200 OK
Content-Length: 517
Content-Type: application/json; charset=UTF-8
X-Openstack-Request-Id: req-req-efd101f6-7dd4-4a97-95f6-d647a7e21cb7
Date: Mon, 17 Aug 2015 06:55:46 GMT

{"description": null, "published_at": null, "tags": [], "depends_on": null, "created_at": "2015-08-14T13:42:13.000000", "type_name": "MyArtifact", "updated_at": "2015-08-14T14:10:17.000000", "visibility": "public", "id": "4d1e26e5-87b7-49b4-99bd-0e6232a80142", "type_version": "2.0", "state": "creating", "version": "12.0.0", "references": [], "prop1": null, "prop2": null, "owner": "b230d6ea1098462bb98d993b9cf386c0", "image_file": null, "deleted_at": null, "screenshots": [], "int_list": null, "name": "artifact-3"}

Changed in glance:
assignee: nobody → Niall Bunting (niall-bunting)
Revision history for this message
Niall Bunting (niall-bunting) wrote :

I can't reproduce this on my version of devstack

Changed in glance:
assignee: Niall Bunting (niall-bunting) → nobody
status: New → Incomplete
description: updated
Changed in glance:
assignee: nobody → dshakhray (dshakhray)
Revision history for this message
Mike Fedosin (mfedosin) wrote :

Hi, I reproduced this bug on the latest devstack with these requests:

1. Create an artifact:
curl -H "X-Auth-Token: 0dad9f8b573346f0b7c541f17f4b3790" -H "Content-Type:application/json" -X POST -d '{"name": "ablablabl", "version": "100"}' http://10.0.2.15:9292/v3/artifacts/myartifact/v2.0/drafts -i

HTTP/1.1 201 Created
Content-Length: 518
Content-Type: application/json; charset=UTF-8
Location: http://10.0.2.15:9292/v3/artifacts/myartifact/v2.0/4352ad29-05b4-4cb7-8bd4-6889ccd53cf6
X-Openstack-Request-Id: req-req-658723a0-5294-4e40-8a09-f0b67a147c05
Date: Sat, 01 Aug 2015 02:31:48 GMT

{"description": null, "published_at": null, "tags": [], "depends_on": null, "created_at": "2015-08-01T02:31:48.000000", "type_name": "MyArtifact", "updated_at": "2015-08-01T02:31:48.000000", "visibility": "private", "id": "4352ad29-05b4-4cb7-8bd4-6889ccd53cf6", "type_version": "2.0", "state": "creating", "version": "100.0.0", "references": [], "prop1": null, "prop2": null, "owner": "bca79a5fd7b946539e9387a7f025f3a7", "image_file": null, "deleted_at": null, "screenshots": [], "int_list": null, "name": "ablablabl"}

2. Trying to add invalid property that is forbidden for this artifact type:
curl -H "X-Auth-Token: 70ab4ece2bc0440da61e116d6615f063" -H "Content-Type:application/json" -X PATCH -d '[{"op": "add", "path": "/banana", "value": "minion_Stuart"}]' http://10.0.2.15:9292/v3/artifacts/myartifact/v2.0/4352ad29-05b4-4cb7-8bd4-6889ccd53cf6 -i

HTTP/1.1 200 OK
Content-Length: 518
Content-Type: application/json; charset=UTF-8
X-Openstack-Request-Id: req-req-12fcf3dc-bc38-4f94-a5eb-f1be8d7383bd
Date: Sat, 01 Aug 2015 02:38:23 GMT

{"description": null, "published_at": null, "tags": [], "depends_on": null, "created_at": "2015-08-01T02:31:48.000000", "type_name": "MyArtifact", "updated_at": "2015-08-01T02:31:48.000000", "visibility": "private", "id": "4352ad29-05b4-4cb7-8bd4-6889ccd53cf6", "type_version": "2.0", "state": "creating", "version": "100.0.0", "references": [], "prop1": null, "prop2": null, "owner": "bca79a5fd7b946539e9387a7f025f3a7", "image_file": null, "deleted_at": null, "screenshots": [], "int_list": null, "name": "ablablabl"}

Server returned 200, but the property wasn't created, but the expected result is 400. Also we have the same situation if we want to replace any non-existent property.

So I think this we should confirm this bug.

Changed in glance:
status: Incomplete → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

Fix proposed to branch: master
Review: https://review.openstack.org/216214

Changed in glance:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/216214
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=9fa4bc2ea8cb0755d071e74431e6d2167d4fe70b
Submitter: Jenkins
Branch: master

commit 9fa4bc2ea8cb0755d071e74431e6d2167d4fe70b
Author: Darja Shakhray <email address hidden>
Date: Mon Aug 24 14:43:17 2015 +0300

    Fix return 200 status code when we operate with nonexistent property

    Glance returned 200 status code when we add/remove/replace element
    to nonexistent "artifacts" property.
    Now glance return 400 status code with description error.

    Change-Id: Ifa9f92de0999052c4db4bcd44fba894f503c7378
    Depends-On: I49a385f124236b22360ee07f5adcba27b3c92603
    Closes-bug: #1485478

Changed in glance:
status: In Progress → Fix Committed
Changed in glance:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.