Commit Graph

20 Commits

Author SHA1 Message Date
zhouxinyong 7939dc7ab9 Replacing the HTTP protocal with HTTPS in using-sessions.rst.
Change-Id: Ib4712414c48ed922ea62460730a4cd5749a3d481
2018-11-17 02:52:04 +00:00
Monty Taylor 56b2c89c39
Split request logging into four different loggers
Python logging is pretty amazingly flexible, and allows us to emit
to arbitrary logging domains so that a consumer can direct log output
with specificity.

Turning on HTTP debug logging currently produces an avalanche of output,
when sometimes just seeing that the requests were made and responded to
is perfectly fine.

Split the loggers used into four - one for request ids, one for request
commands, one for response headers and one for response body content.
Make them subloggers of keystoneauth.session so that if a user does nothing,
their existing logging config will be unchanged.

If someone passes in a logger, behave as before logging all things to
the provided logger.

While we're at it, document this in the using-sessions document, so that
people know that the loggers exist and what they do.

NOTE:
The tox (>=1.7.0) by default sets a random python hash seed which
causes ordering of dicts and sets to be different between tests runs.
Disabled the random python hash seed by setting PYTHONHASHSEED=0 to
fix the random failure of below test:

keystoneauth1.tests.unit.test_session.SessionAuthTests.
test_split_loggers

The PYTHONHASHSEED=0 is removed in the followup patch so that we can
separate the tracking down of ordering issues in tests from this patch.

Change-Id: Ide7dac8adf5c76c9019c35867cda632aff39770f
2018-01-31 11:51:59 -06:00
Eric Fried bd9a9eb7c2 Nits in using-sessions.rst
Fix punctuation and formatting nits from [1].

[1] https://review.openstack.org/#/c/477566/11/doc/source/using-sessions.rst

Change-Id: I3987d317f2a858cf7cb6a66dfa90fa88cba5e94c
2017-09-01 17:14:09 -05:00
Monty Taylor 5058d40c51 Fixed minor review comments and updated docs
The previous microversion patch had some review comments from samuel and
colleen that this addresses. Also, add a release note.

Change-Id: Id83643ee5a00abc5134a88dfa5bc8ddb4f5a247a
2017-07-20 18:36:12 +00:00
Monty Taylor 218adc333e
Add ability to specify a microversion in a request
The user now has the ability to know what microversions are available,
but needs to be able to send a microversion header with their request.

Add a microversion parameter to Session that will construct and send the
header. The microversion header requires a service_type. One should be
available but it's possible for it to be missing if someone is using an
endpoint_override. Provide a parameter to let the user specify a
service_type for the microversion call in such cases.

Change-Id: I63cdd67701749630228f9496eda82b3c8747a608
2017-07-19 02:51:49 +09:00
Monty Taylor 24b09f4088 Add support for next_min_version and not_before
The API-WG just approved the spec for version discovery documents to
optionally provide "next_min_version" and "not_before" information.

  http://specs.openstack.org/openstack/api-wg/guidelines/microversion_specification.html#version-discovery

The intended use of these is to communicate that at a point in the
future the service plans to raise the minimum microversion. It can't say
when that will happen, as a service does not know when deployers will
decide to upgrade their services. But it can communicate the earliest
date it's possible to happen, which would be the first date the service
itself would raise the minimum.

This can be used to emit warnings to users who are using a microversion
less than the next_min_version and to tell them how long they have to
think about it.

Currently keystoneauth will not consume these for that purpose. This
patch is merely about collecting the information from the discovery
document if it is there so a consumer can take action on it if they
wish.

Change-Id: Ibc404ef55eeae721a0d1d16e4e3e51ad77b5a75c
2017-07-15 14:29:24 +00:00
Monty Taylor de41fec992 Remove kwargs from adapter.get_endpoint_data
get_endpoint_data on an adapater is intended to return the endpoint_data
for the endpoint the adapter is mounted to, so passing in additional
kwargs doesn't make any sense. What's more, the interaction between the
existing values and the passed in values is hard to reason about.

Update the docs on using get_endpoint_data to highlight this.

Change-Id: I851c615407bc3e22af4350a4facf8488fa9c7945
2017-07-15 14:27:28 +00:00
Monty Taylor 05c3a471ae
Add paragraph clarifying major and micro versions
People get confused with major version discovery vs. microversion usage.
Try to make it very clear what's going on.

Change-Id: I2be8670998f531ee4777876413979a63279a59ab
2017-07-14 14:32:41 -05:00
Monty Taylor 416675f619
Update docs and add a release note
We added a bunch of new capabilities around discovery. Document them.

Change-Id: Ie0fa47e0cee918d7b8a9069eaf01931f64a54e58
2017-07-14 09:47:36 -05:00
wangxiyuan 313006a4d5 Fix the doc error in "using-session"
Change-Id: I75bf2d6419f99bccb40ed372bde0e86be2a47b85
2016-07-28 16:50:50 +08: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
Colleen Murphy 7d0cb04e6d Fix documentation example again
In d0617885 the example in the Service Discovery section was changed to
include the full URL of the endpoint. On closer inspection, it turns
out that the example is deliberately pointing out that you don't need
the full URL when using endpoint filtering, since the endpoint filter
is supposed to look up the endpoint in the catalog. The reason it
wasn't working out of the box, as pointed out in the bug[1], was that
devstack sets up v2.0 endpoints, so the example path was appending /v3
to a v2.0 endpoint and failing.

This patch reverts the example back to using just a path, but omits the
'/v3' part of the path and uses the admin interface so that it will
work on v2.0. This will work out of the box on devstack and will still
work if the user has set up endpoints with '/v3' in them.

[1] https://bugs.launchpad.net/keystoneauth/+bug/1519054/comments/2

Change-Id: I11637aaa1939327eb6d1819c1b740a99e0f21e83
2016-04-15 11:06:49 -07:00
Alexander Makarov d061788546 Documentation example fix
Session usage example need full URL to work

Change-Id: I858f84dacc648250643711ac1d9b6d7b684110f8
Closes-Bug: 1519054
2016-04-11 20:34:25 +03:00
Brant Knudson 9b74f9d5ec Editorial nits for docs
Reworded some sections.

Cleaned up some rst formatting. `` is for string constants, ` is for
field names.

Change-Id: Iad6c2baa5c41ed70aea1e30f677ba2682879952c
2016-03-01 20:35:11 +00: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
Jamie Lennox 5abb1743f3 Remove confusing documentation
When copying this documentation over from keystoneclient we much have
simply replaced occurences of keystoneclient with keystoneauth. Details
how to migrate keystoneclient to using sessions make sense in
keystoneclient however the migration doc makes no sense in keystoneauth1
because those parameters don't exist.

Change-Id: I70160f42115d7dfe7610699479baf2e9420fe1b3
2015-12-10 14:15:11 +11:00
Ghe Rivero a0e1d741d1 Fix doc session example
Update doc example to use keystoneclient and correct
v3 identity api parameters

Change-Id: I1ce288a1620c4aabd0aeaf78cb94ea13aa0657f8
2015-09-22 13:24:56 +02: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
Jamie Lennox 581f4cd493 Change keystoneclient to keystoneauth in docs
This was simply the result of:

find -type f | xargs sed -i 's/keystoneclient/keystoneauth/g'
find -type f | xargs sed -i 's/python-keystoneauth/keystoneauth/g'

in the docs directory to fix the build failure.

Will look at a doc rewrite soon.

Change-Id: I05d4be12f31ea47e917dc79e50d17b174bf89938
2015-04-30 18:23:47 +10:00
Morgan Fainberg 49a223a370 Add doc data back in. This will be replaced by real doc data.
Change-Id: I59c11298a1d350a81a7298e9333da0c36e61a1a7
2015-04-28 16:12:16 -04:00