Commit Graph

14 Commits (049e2e6b9bd72570f852f9b86dba758588fde939)

Author SHA1 Message Date
Jamie Lennox c5bac3a32c Don't issue deprecation warning when nesting adapters
Auth token middleware does a bit of a hack where it passes an Adapter in
as a session to the client. This is useful there because we need to know
much more about the authentication information than we do in most
clients.

We should look at fixing this in auth_token middleware, however for now
we shouldn't issue a deprecation warning when a user passes an Adapter
as a session object because this has always been designed to work - just
not something we recommend.

Change-Id: If7ebe59d5908275e607f32244027c8e6f3d1e157
Closes-Bug: #1647230
2016-12-06 09:14:44 +11:00
Jenkins 946278d98c Merge "Show deprecation warning and limit features for KSC session" 2016-10-20 04:01:43 +00:00
Jamie Lennox 57f8d2cde5 Allow setting client_name, client_version on adapter
You can pass client_name and client_version to Adapter.__init__ but for
most clients this means overriding Adapter.__init__ and setdefault()-ing
the client_name and version.

As most clients already override the Adapter object it'd be easier if
they could just set these values on the class as they are not going to
change between instances.

Change-Id: I301a7f77c8cf423bc1d45e3dcbb2325f6853b9a9
2016-10-20 02:15:42 +00:00
Jamie Lennox 6c71469783 Show deprecation warning and limit features for KSC session
There are still a lot of places where keystoneclient sessions are being
used and we've made a fair effort to maintain compatibility with these
sessions.

Unfortunately passing client_name and client_version for user_agent
generation is something only present in keystoneauth and passing it to a
keystoneclient session results in failure.

Whilst it would be good to just tell people to fix their code in reality
we'll probably be dealing with this for a while so just check to ensure
it really is a keystoneauth session we are passing parameters to and
warn otherwise.

Change-Id: I4d51ee08cfa9094443aca7128fe5323a95974a4d
2016-10-20 02:15:34 +00:00
Jamie Lennox eb5571a6ca Allow specifying client and service info to user_agent
Allow specifying a service name and version to the session and a client
name and version to the adapter. The way this will work is that
libraries such as keystoneclient will pass client_name and
client_version when creating their adapter. Then when nova or another
service creates a session it will provide the service name and version.
The combination of these will be used to provide a meaningful user
agent.

Change-Id: Ibe516d9b248513579d5e8ca94015c4ae9c00f3f9
Closes-Bug: #1614846
2016-10-07 09:53:50 +11:00
Jamie Lennox 1045a147dd Add additional_headers to session and adapter
Allow clients and services to set additional_headers that will be sent
with all requests made by the session.

Change-Id: Idbd2e5159de5790c7db65c806b964f220bb6628e
2016-07-13 17:09:46 +10:00
Colleen Murphy 118c9629e5 Expose allow parameters for URL discovery
The Discover class can fiilter API versions by experimental status, deprecated
status, and unknown status, and potentially more designations in the future.
The parameters that control this were not exposed in the Session or Adapter, so
users could not take advantage of this filtering through normal means. This
patch creates an 'allow' parameter for the Adapter that will get passed down as
keyword arguments into Discover.raw_version_data().

Now, given an unversioned endpoint like:

    $ openstack endpoint show cinder
    +--------------+----------------------------------+
    | Field        | Value                            |
    +--------------+----------------------------------+
    | adminurl     | http://192.168.122.183:8776      |
    | enabled      | True                             |
    | id           | 485107c1d92b41829c331a2dc82aaaeb |
    | internalurl  | http://192.168.122.183:8776      |
    | publicurl    | http://192.168.122.183:8776      |
    | region       | RegionOne                        |
    | service_id   | 01b4f36a173d4c59b31fc95763095373 |
    | service_name | cinder                           |
    | service_type | volume                           |
    +--------------+----------------------------------+

an Adapter can be used like this (this example would be expected to fail
since it disallows the deprecated volume V1 API):

    auth = Password(<auth_params>)
    sess = session.Session(auth=auth)
    adptr = adapter.Adapter(sess)
    adptr.get('<project-id>/volumes',
              endpoint_filter={'service_type': 'volume',
                               'interface': 'public',
                               'version': 1},
              allow={'allow_deprecated': False}))

This is inspired by an abandoned patch to keystoneclient[1] that exposed this
information as a tuple. The problem with exposing it like that is that
raw_version_data() defaults allow_deprecated to True, so including 'deprecated'
in the tuple or not including it would have the same result. Using a dict
allows us to keep the Discover interface the same.

[1] https://review.openstack.org/#/c/130159

Co-authored-by: Endre Karlson <endre.karlson@hp.com>

Change-Id: I54c29e1c2a4a2b02a3967f4ea108b8d2533616eb
Closes-bug: #1394245
2016-05-08 10:23:21 -07:00
Navid Pustchi 2e0c0030a9 Removing tox ignore D400.
Currently tox ignores D400 (D400: First line should end with a period).
This change removes D400 ignore.
All pep8 violatios are fixed.

Change-Id: I9190a15a36c90d3c60a9c520cb53d5f182b0c4e9
2016-04-18 21:20:51 +00:00
Prosunjit Biswas 7d448dbc55 Fix for PEP8 violation - D202
(No blank lines allowed after function docstring.)

Change-Id: Ice629f0ef8b1431f0c4655ff37efe0cd5e9c86ec
2016-03-30 04:18:34 +00:00
Jamie Lennox f21def7061 Use positional library instead of our own copy
The positional library was spun directly out of what keystoneauth1 was
using so this is a fairly trivial change.

Change-Id: I7931ed1547d2a05e2d248bc3240a576dc68a0a40
2016-01-25 09:31:48 +11:00
Brant Knudson d493e71070 Docstring corrections
Fixes some of the more obvious issues with docstrings.

Change-Id: I85faf10ecc99f3ab9f0d5670e32df74bedd02793
2015-12-17 17:09:58 -06:00
Monty Taylor d123ca56d5 Default for service service type should be empty
It's an override type, which means we need to know if it's set or not.
The default value for it is, well, obvious - since it's based on the
name. This was an oversight in the duplication of the method.

Change-Id: I5fe1d1dd5f0f1e34ec5eddf92cb6964cc389ca51
2015-12-03 08:27:02 -08:00
Monty Taylor e96c075f1f Add argparse registration from Adapter objects
Similar to Session and auth plugins, there are a set of argparse
arguments that feed directly into the Adapter class. Add a function
to register the appropriate argparse arguments, as well as one to
create an Adapter from a session and a set of arguments.

Change-Id: Ifea90b981044009c3642b268dd639a703df1ef05
2015-11-28 16:47:28 -05:00
Morgan Fainberg a0000e4e9a Move to the keystoneauth1 namespace
Conver from the keystoneauth namespace to keystoneauth1. This is to
ensure that is is possible to install all versions of keystoneauth
side-by-side.

Change-Id: Ibbaf11525980c8edb5968d8b8ee19c55094e77d8
2015-06-25 16:48:54 -07:00