8 Commits

Author SHA1 Message Date
Jamie Lennox
1263bd7c3a Provide a conversion function for creating session
Session.construct will create a session based upon the kwargs that used
to be passed to a client __init__ function. This will allow clients an
easy path to providing compatibility with deprecated arguments.

Make use of the function throughout discovery. Discovery was initially
released prior to the session object being completed and was therefore
handled with the same arguments as a client. Instead we should use a
session object so use the conversion function to convert those kwargs
into a session object if one is not provided.

Change-Id: I8dc1e0810ea6ebc6ea648ec37d7881825c566676
2014-02-03 13:42:53 +10:00
Eric Guo
252b6e423d Adjust import items according to hacking import rule
This patch adjust import items and add missing blank lines acording
to http://docs.openstack.org/developer/hacking/#imports
{{stdlib imports in human alphabetical order}}
\n
{{third-party lib imports in human alphabetical order}}
\n
{{project imports in human alphabetical order}}
\n
\n
{{begin your code}}

hacking project also enforce some checks for import group.
Let make the change in keytoneclient

Change-Id: Ic83bd5ee426905588f4a2d555851a9a01fc69f02
2014-01-17 23:21:38 +08:00
Jenkins
5fe86af4fa Merge "Saner debug log message generation" 2014-01-15 18:38:25 +00:00
Jamie Lennox
e2a5c2a829 Saner debug log message generation
For some reason building the debug log would include spaces in the
message elements and join on the empty string. It makes much more sense
to just build the list and join on the space.

Change-Id: Idd82787b87518c56122d0b13551f84529306337c
2014-01-09 01:11:42 +00:00
Jamie Lennox
165da791af Controllable redirect handling
The requests library handles redirects as a browser would, which has the problem
that forwarding a POST will convert it to a GET. This is not necessarily
intuitive for an API. Handle all redirection manually and provide some
control over how far redirection can go.

Closes-Bug: 1267286
Change-Id: I24596a9c39cc29db28a66c3053ef3954b33abf90
2014-01-09 10:20:08 +10:00
Jamie Lennox
6728bf3ccb Move redirect handling to session
Particularly 305 is expected to be handled by the tests so we need to
handle this centrally if we want to have session and non-session clients
to work the same way.

Change-Id: Id4ec35ddd8b8304d24df9e6cd2ab995d123ef125
2013-12-20 03:51:50 +00:00
Jamie Lennox
a8adb476f7 Remove debug specific handling
I think debug handling was initially done this way for CLI handling
where we wanted to make sure only the correct information was printed to
the console. However as logging.basicConfig sets up a stream handler on
the root logging object I can't see any purpose to the debug handling in
the actual HTTPClient. Further than this it is completely wrong that a
client library is messing with it's logging level, this should be handled
by an application.

The debug flag is maintained and deprecated in HTTPClient and removed
from the session object. There has been no release since the addition of
session so there is no problem with compatibility.

Change-Id: Ib00f3d93d099ed1a9dd25f17121610a7289f0061
2013-12-20 13:48:06 +10:00
Jamie Lennox
2c5dcf9bf1 Extract a base Session object
A wrapper around a number of connection variables. This will be extended
later with principals such as Kerberos authentication and http sessions.

The intent is that this session object will become the basis for all
other client library communications in OpenStack (as keystone wants to
control things like authentication for everybody).

Change-Id: I8ee728c49d554659d7057ebf17d0f8ceea4d7d8e
Part of: blueprint auth-plugins
2013-11-28 09:20:43 +10:00