Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: OpenStack: Dev

[Glance] Using HTTP PATCH

 

 

OpenStack dev RSS feed   Index | Next | Previous | View Threaded


brian.waldon at rackspace

May 23, 2012, 1:22 PM

Post #1 of 10 (414 views)
Permalink
[Glance] Using HTTP PATCH

Hey guys,

I'm considering using PATCH rather than PUT for image updates in the v2 Image API, but I wanted to make sure there weren't any major blockers that I might be missing. As far as I can tell, the python libraries we use in Glance support it (httplib2, requests). However, I discovered that Squid doesn't document official support of the method: http://wiki.squid-cache.org/SquidFaq/SquidLogs. I wanted to ask if there are any other key infrastructure pieces that foolishly hard-code request methods like this. It might make us want to rethink using PATCH at all.

Brian


harlowja at yahoo-inc

May 23, 2012, 1:39 PM

Post #2 of 10 (413 views)
Permalink
Re: [Glance] Using HTTP PATCH [In reply to]

Is there anyway u can just make it a configuration option?

v2imagemethod = 'PUT'...

On 5/23/12 1:22 PM, "Brian Waldon" <brian.waldon [at] rackspace> wrote:

Hey guys,

I'm considering using PATCH rather than PUT for image updates in the v2 Image API, but I wanted to make sure there weren't any major blockers that I might be missing. As far as I can tell, the python libraries we use in Glance support it (httplib2, requests). However, I discovered that Squid doesn't document official support of the method: http://wiki.squid-cache.org/SquidFaq/SquidLogs. I wanted to ask if there are any other key infrastructure pieces that foolishly hard-code request methods like this. It might make us want to rethink using PATCH at all.

Brian


brian.waldon at rackspace

May 23, 2012, 1:45 PM

Post #3 of 10 (415 views)
Permalink
Re: [Glance] Using HTTP PATCH [In reply to]

Above all, I want to keep the API spec as clean as possible. We would have to design a way to communicate what method we use if we make it configurable by the backend like you suggest. That seems like its moving away from cleanliness rather than toward.

I'm more interested in first hearing if PATCH is a viable option. Rails is going to use it, so I feel like people are going to have to get on board eventually.

Brian


On May 23, 2012, at 1:39 PM, Joshua Harlow wrote:

> Is there anyway u can just make it a configuration option?
>
> v2imagemethod = ‘PUT’...
>
> On 5/23/12 1:22 PM, "Brian Waldon" <brian.waldon [at] rackspace> wrote:
>
> Hey guys,
>
> I'm considering using PATCH rather than PUT for image updates in the v2 Image API, but I wanted to make sure there weren't any major blockers that I might be missing. As far as I can tell, the python libraries we use in Glance support it (httplib2, requests). However, I discovered that Squid doesn't document official support of the method: http://wiki.squid-cache.org/SquidFaq/SquidLogs. I wanted to ask if there are any other key infrastructure pieces that foolishly hard-code request methods like this. It might make us want to rethink using PATCH at all.
>
> Brian
>


nick.barcet at canonical

May 23, 2012, 1:55 PM

Post #4 of 10 (415 views)
Permalink
Re: [Glance] Using HTTP PATCH [In reply to]

On 05/23/2012 09:39 PM, Joshua Harlow wrote:
> Is there anyway u can just make it a configuration option?
>
> v2imagemethod = ‘PUT’...

This would make sense as rfc 5789 is only 2 years old, which means that
there must be numerous firewalls and proxies which may not have been
updated yet in production, if an update is available at all, that will
just block the patch method... Most of the customers we are talking to
are not that keen on updating what works.

Nick

> On 5/23/12 1:22 PM, "Brian Waldon" <brian.waldon [at] rackspace> wrote:
>
> Hey guys,
>
> I'm considering using PATCH rather than PUT for image updates in the
> v2 Image API, but I wanted to make sure there weren't any major
> blockers that I might be missing. As far as I can tell, the python
> libraries we use in Glance support it (httplib2, requests). However,
> I discovered that Squid doesn't document official support of the
> method: http://wiki.squid-cache.org/SquidFaq/SquidLogs. I wanted to
> ask if there are any other key infrastructure pieces that foolishly
> hard-code request methods like this. It might make us want to
> rethink using PATCH at all.
>
> Brian
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to : openstack [at] lists
> Unsubscribe : https://launchpad.net/~openstack
> More help : https://help.launchpad.net/ListHelp
Attachments: signature.asc (0.88 KB)


brian.waldon at rackspace

May 23, 2012, 2:02 PM

Post #5 of 10 (412 views)
Permalink
Re: [Glance] Using HTTP PATCH [In reply to]

Relevant links:

https://review.openstack.org/#/c/7716/
http://tools.ietf.org/html/rfc5789
http://weblog.rubyonrails.org/2012/2/25/edge-rails-patch-is-the-new-primary-http-method-for-updates/


On May 23, 2012, at 1:22 PM, Brian Waldon wrote:

> Hey guys,
>
> I'm considering using PATCH rather than PUT for image updates in the v2 Image API, but I wanted to make sure there weren't any major blockers that I might be missing. As far as I can tell, the python libraries we use in Glance support it (httplib2, requests). However, I discovered that Squid doesn't document official support of the method: http://wiki.squid-cache.org/SquidFaq/SquidLogs. I wanted to ask if there are any other key infrastructure pieces that foolishly hard-code request methods like this. It might make us want to rethink using PATCH at all.
>
> Brian
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to : openstack [at] lists
> Unsubscribe : https://launchpad.net/~openstack
> More help : https://help.launchpad.net/ListHelp


john.postlethwait at nebula

May 23, 2012, 2:38 PM

Post #6 of 10 (420 views)
Permalink
Re: [Glance] Using HTTP PATCH [In reply to]

Patch certainly seems more semantically proper in this context, and I love being semantically proper using HTTP… That being said I am not currently sure of any places where this might be a problem. There was mention of the firewall issues, but I don't know if that is necessarily true.

Do firewalls typically/ever do deep inspections of HTTP headers in the communication and filter on the HTTP method? It wouldn't even be able to do such a thing if you are using HTTPS, would it?

John Postlethwait
Nebula, Inc.
206-999-4492


On Wednesday, May 23, 2012 at 2:02 PM, Brian Waldon wrote:

> Relevant links:
>
> https://review.openstack.org/#/c/7716/
> http://tools.ietf.org/html/rfc5789
> http://weblog.rubyonrails.org/2012/2/25/edge-rails-patch-is-the-new-primary-http-method-for-updates/
>
>
> On May 23, 2012, at 1:22 PM, Brian Waldon wrote:
> > Hey guys,
> >
> > I'm considering using PATCH rather than PUT for image updates in the v2 Image API, but I wanted to make sure there weren't any major blockers that I might be missing. As far as I can tell, the python libraries we use in Glance support it (httplib2, requests). However, I discovered that Squid doesn't document official support of the method: http://wiki.squid-cache.org/SquidFaq/SquidLogs. I wanted to ask if there are any other key infrastructure pieces that foolishly hard-code request methods like this. It might make us want to rethink using PATCH at all.
> >
> > Brian_______________________________________________
> > Mailing list: https://launchpad.net/~openstack
> > Post to : openstack [at] lists (mailto:openstack [at] lists)
> > Unsubscribe : https://launchpad.net/~openstack
> > More help : https://help.launchpad.net/ListHelp
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to : openstack [at] lists (mailto:openstack [at] lists)
> Unsubscribe : https://launchpad.net/~openstack
> More help : https://help.launchpad.net/ListHelp
>
>


mnot at mnot

May 24, 2012, 4:12 AM

Post #7 of 10 (413 views)
Permalink
Re: [Glance] Using HTTP PATCH [In reply to]

On 24/05/2012, at 6:22 AM, Brian Waldon wrote:

> Hey guys,
>
> I'm considering using PATCH rather than PUT for image updates in the v2 Image API, but I wanted to make sure there weren't any major blockers that I might be missing. As far as I can tell, the python libraries we use in Glance support it (httplib2, requests). However, I discovered that Squid doesn't document official support of the method: http://wiki.squid-cache.org/SquidFaq/SquidLogs.

Oh, how embarrassment. I'll get that fixed ASAP.


> I wanted to ask if there are any other key infrastructure pieces that foolishly hard-code request methods like this. It might make us want to rethink using PATCH at all.

You've found the major one above; there are probably a few over-zealous inspecting firewalls out there as well, but given that this'll run over TLS (right?), neither Squid or any other such intermediary should be a problem (they could be deployed for SSL termination and/or as reverse proxies, but Squid, at least, can be configured to accept new methods <http://www.squid-cache.org/Versions/v3/3.0/cfgman/extension_methods.html>).

The other limitation is having defined and registered patch formats. The IETF is currently working on one for JSON; it should be progressing soon. <http://tools.ietf.org/html/draft-ietf-appsawg-json-patch>

Cheers,


--
Mark Nottingham http://www.mnot.net/




_______________________________________________
Mailing list: https://launchpad.net/~openstack
Post to : openstack [at] lists
Unsubscribe : https://launchpad.net/~openstack
More help : https://help.launchpad.net/ListHelp


brian.waldon at rackspace

May 24, 2012, 5:06 AM

Post #8 of 10 (414 views)
Permalink
Re: [Glance] Using HTTP PATCH [In reply to]

On May 24, 2012, at 4:12 AM, Mark Nottingham wrote:

> The other limitation is having defined and registered patch formats. The IETF is currently working on one for JSON; it should be progressing soon. <http://tools.ietf.org/html/draft-ietf-appsawg-json-patch>

I guess I haven't done enough research on PATCH, as I hadn't discovered this yet. I was just planning on using the method to be more semantically correct: allowing requests with a content-type of application/json and a partial representation of an entity. Is there anything about PATCH that would disallow that?

Waldon
_______________________________________________
Mailing list: https://launchpad.net/~openstack
Post to : openstack [at] lists
Unsubscribe : https://launchpad.net/~openstack
More help : https://help.launchpad.net/ListHelp


mnot at mnot

May 24, 2012, 5:09 AM

Post #9 of 10 (415 views)
Permalink
Re: [Glance] Using HTTP PATCH [In reply to]

On 24/05/2012, at 10:06 PM, Brian Waldon wrote:

>
> On May 24, 2012, at 4:12 AM, Mark Nottingham wrote:
>
>> The other limitation is having defined and registered patch formats. The IETF is currently working on one for JSON; it should be progressing soon. <http://tools.ietf.org/html/draft-ietf-appsawg-json-patch>
>
> I guess I haven't done enough research on PATCH, as I hadn't discovered this yet. I was just planning on using the method to be more semantically correct: allowing requests with a content-type of application/json and a partial representation of an entity. Is there anything about PATCH that would disallow that?


Yes, very much so. See:

http://www.rfc-editor.org/errata_search.php?rfc=5789

Cheers,


--
Mark Nottingham http://www.mnot.net/




_______________________________________________
Mailing list: https://launchpad.net/~openstack
Post to : openstack [at] lists
Unsubscribe : https://launchpad.net/~openstack
More help : https://help.launchpad.net/ListHelp


mnot at mnot

May 29, 2012, 5:03 PM

Post #10 of 10 (399 views)
Permalink
Re: [Glance] Using HTTP PATCH [In reply to]

On 25/05/2012, at 4:53 AM, David Lutterkort wrote:

> At the same time, the patch language requires that clients either track
> changes in this language (difficult if the client's internal
> representation is very different from the JSON representation on the
> wire) or be able to diff an old and new JSON object and generate a
> json-patch object.
>
> Has anyone looked into making it easier for clients to produce
> json-patch objects ?

I think the common use case is going to be "change the foo property to 3" or "add x to the bar array". At least, that's how I'd see it happening in OpenStack.

If it is, doing so in json-patch is quite simple; you just specify the corresponding arguments (add, replace, etc.). I suppose a little utility library might make it easier (e.g., give it a JSON object and allow manipulating it with add, replace, etc. methods), but that's just some sugar on top.

BTW, whether we use PUT or PATCH, we should be using conditional requests w/ strong validators and 412/428 status codes as necessary.

Cheers,

P.S. Full disclosure: I've recently been asked to take over editing that draft and json-pointer, to push them to completion.


--
Mark Nottingham http://www.mnot.net/




_______________________________________________
Mailing list: https://launchpad.net/~openstack
Post to : openstack [at] lists
Unsubscribe : https://launchpad.net/~openstack
More help : https://help.launchpad.net/ListHelp

OpenStack dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.