Glance V2 incorrectly implements JSON Patch 'add'

Bug #1250158 reported by Eddie Sheffield
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Medium
Roman Vasilets

Bug Description

According to the RFC for JSON Patch (http://tools.ietf.org/html/rfc6902) the 'add' operation, in the event that the property being added already exists, should replace the existing value. However Glance V2 raises a 409 - Conflict error.

From the RFC. Note the third bullet:

'The "add" operation performs one of the following functions,
   depending upon what the target location references:

   o If the target location specifies an array index, a new value is
      inserted into the array at the specified index.

   o If the target location specifies an object member that does not
      already exist, a new member is added to the object.

   o If the target location specifies an object member that does exist,
      that member's value is replaced.'

Feilong Wang (flwang)
Changed in glance:
assignee: nobody → Fei Long Wang (flwang)
importance: Undecided → Medium
Revision history for this message
Feilong Wang (flwang) wrote :

Seems the draft 4 is different, see http://tools.ietf.org/html/draft-pbryan-json-patch-04

Changed in glance:
status: New → Triaged
Revision history for this message
Eddie Sheffield (eddie-sheffield) wrote :

I'm wondering if we need to rev the api and / or media type versions when we fix this? On the one hand it does change functionality slightly. But it would be to conform to a standard we already claim to support in our current version, so it *is* a bug fix. Also our versions are a bit "loose" in that when you get the versions doc from Glance it reports v2.0, 2.1, and 2.2 but if we claim 2.1 supports draft 04 while 2.2 supports draft 10 / final spec we really don't do that anyway.

Personally I can't think of any legitimate situation where someone would be *depending* on the current functionality. Rather I might see someone working around it, and fixing it in the server shouldn't cause a problem. So I think we can just fix it under the current versions as we would any other bug. But I wanted to bring it up.

Revision history for this message
Feilong Wang (flwang) wrote :

I have discussed with other guys about this, because I have some concern about the backward compatibility. I suggest we discuss it in the weekly meeting.

Changed in glance:
assignee: Fei Long Wang (flwang) → nobody
Revision history for this message
Mark Washenberger (markwash) wrote :

If necessary, we could make it so the old content type behaves in the same way as before, but have the bug fixed for the latest content type. Would that address your concerns, Fei?

Revision history for this message
David Koo (kpublicmail) wrote :

So any conclusions as to what approach to take ... are we going with media/content type versioning or is it something else?

Changed in glance:
assignee: nobody → Roman Vasilets (rvasilets)
Changed in glance:
status: Triaged → In Progress
Revision history for this message
Zhi Yan Liu (lzy-dev) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/117295
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=2b8c7c9595345582d78a773c5e1241b9e3b7ee8d
Submitter: Jenkins
Branch: master

commit 2b8c7c9595345582d78a773c5e1241b9e3b7ee8d
Author: Roman Vasilets <email address hidden>
Date: Wed Aug 27 18:40:41 2014 +0300

    Fix glance V2 incorrectly implements JSON Patch'add'

    According to the RFC for JSON Patch
    http://tools.ietf.org/html/rfc6902#section-4.1
    the 'add' operation, in the event that the property being
    added already exists, should replace the existing value. For backward
    compatibility We've fix it only for the latest content type.

    Change-Id: Ia4be8b384f8b7f193f139f2206ceea25786b5cc3
    Closes-bug: 1250158
    DocImpact
    Partial-bug: #1277104

Changed in glance:
status: In Progress → Fix Committed
Revision history for this message
Roman Vasilets (rvasilets) wrote :

Hi, I am proposing to close this bug.

Thierry Carrez (ttx)
Changed in glance:
milestone: none → kilo-1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in glance:
milestone: kilo-1 → 2015.1.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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