Redirection handling.

Bug #892152 reported by klmitch
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-novaclient
Fix Released
High
Unassigned

Bug Description

Made redirection based on Chris's changes. Looks more clear than previous.

Revision history for this message
klmitch (q-noreply) wrote :

Cool ... just needs a unit test and the check for 305 should be explicit, not implied when not 200/204

Revision history for this message
klmitch (q-noreply) wrote :

Also, only handles a single redirect ... you may want to consider the recursive approach I took here:

https://github.com/SandyWalsh/python-novaclient/blob/master/novaclient/client.py

Revision history for this message
klmitch (q-noreply) wrote :

If I remember correctly, nova redirects us directly to keystone. We can't rely on that? I'm not web-world guru, and maybe my assumptions look naive.

Revision history for this message
klmitch (q-noreply) wrote :

While users should be redirected to keystone, most users will start with keystone as their endpoint.

Authentication to keystone is the way you get the endpoints for the user.

Revision history for this message
klmitch (q-noreply) wrote :

Jesse, where do I tell Keystone what the Nova endpoint is for the management_url?

And does it makes sense for Keystone to know about that, since it could be used for may different services? And not having the management_url would bust the way RS Auth works fundamentally, no?

Revision history for this message
klmitch (q-noreply) wrote :

> Jesse, where do I tell Keystone what the Nova endpoint is for the management_url?

Here are examples of setting various endpoints in the service catalog: https://github.com/openstack/keystone/blob/master/bin/sampledata.sh#L47

> And does it makes sense for Keystone to know about that, since it could be used for may different services? And not having the management_url would bust the way RS Auth works fundamentally, no?

I might be missing something (we can bring Ziad over to verify) but I think that is the way RS Auth works:

* Client hits auth endpoint, getting a token and either headers for management urls OR a service catalog (auth 1.x vs 2.0)
* client then hits the management url from header or service catalog

While you might know that the compute endpoint is http://example.com/v1.1/servers - there is no contract in the api that it won't change. The contract is that you re-authenticate to the auth service to get a new token / endpoint...

Does this cause a blowup of the size of the service catalog since it is number of services * number of regions ... YES - but that is what rax idm / public cloud does ... and we need to do it for compatibility :-/

Revision history for this message
klmitch (q-noreply) wrote :

Hmm, i looked in httplib2 code, it can handle all redirects except 305 (surprise!). Maybe it will be more clear to handle all redirects in request() code with small workaround with 305?

Revision history for this message
klmitch (q-noreply) wrote :

Perhaps we can tidy it up a little ... maybe something like: http://paste.openstack.org/show/2131/ (untested)

And would it make sense to share the resp.status handling code in the v1/v2_auth() sections?

Revision history for this message
klmitch (q-noreply) wrote :

and maybe an explicit 'return None' in the success cases?

Revision history for this message
klmitch (q-noreply) wrote :

I tried that, but both versions look very tricky compared to old code. https://github.com/chemikadze/python-novaclient/blob/tricky-retry/novaclient/client.py#L133

Tested on my local installation, log: http://paste.openstack.org/show/2138/

Revision history for this message
klmitch (q-noreply) wrote :

Generally this branch has been working well for me. I see your point about it being equally confusing. I'll merge once we get that little fix and we can re-eval later. Nice work!

Revision history for this message
klmitch (q-noreply) wrote :

Oh, we need a test on this too ... sorry :/

Revision history for this message
klmitch (q-noreply) wrote :

I thought about that, but had not yet time to write tests.

Revision history for this message
klmitch (q-noreply) wrote :

There were a couple of of other PR's that went through too that will require a fresh merge from trunk anyway.

Revision history for this message
klmitch (q-noreply) wrote :

Added tests for redirection.

Revision history for this message
klmitch (q-noreply) wrote :

Sandy, I think all necessary had been done. Tests passing, trunk updates merged (replacing my more general WrongResponse with AuthFailure).

Revision history for this message
klmitch (q-noreply) wrote :

Nice work ... thanks again!

Thierry Carrez (ttx)
affects: nova → python-novaclient
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.