Merge "Add novaclient client_name and client_version to user-agent"

This commit is contained in:
Jenkins 2017-04-18 15:17:35 +00:00 committed by Gerrit Code Review
commit 080a8e4d48
3 changed files with 25 additions and 0 deletions

View File

@ -38,6 +38,21 @@ parameter. Similarly, if your cloud uses keystone v3 and you have a DOMAIN_NAME
or DOMAIN_ID, provide it as `user_domain_(name|id)` and if you are using a
PROJECT_NAME also provide the domain information as `project_domain_(name|id)`.
novaclient adds 'python-novaclient' and its version to the user-agent string
that keystoneauth produces. If you are creating an application using novaclient
and want to register a name and version in the user-agent string, pass those
to the Session::
>>> sess = session.Session(
... auth=auth, app_name'nodepool', app_version'1.2.3')
If you are making a library that consumes novaclient but is not an end-user
application, you can append a (name, version) tuple to the session's
`additional_user_agent` property::
>>> sess = session.Session(auth=auth)
>>> sess.additional_user_agent.append(('shade', '1.2.3'))
For more information on this keystoneauth API, see `Using Sessions`_.
.. _Using Sessions: http://docs.openstack.org/developer/keystoneauth/using-sessions.html

View File

@ -33,6 +33,7 @@ import pkg_resources
osprofiler_profiler = importutils.try_import("osprofiler.profiler")
osprofiler_web = importutils.try_import("osprofiler.web")
import novaclient
from novaclient import api_versions
from novaclient import exceptions
from novaclient import extension as ext
@ -48,6 +49,9 @@ extensions_ignored_name = ["__init__"]
class SessionClient(adapter.LegacyJsonAdapter):
client_name = 'python-novaclient'
client_version = novaclient.__version__
def __init__(self, *args, **kwargs):
self.times = []
self.timings = kwargs.pop('timings', False)

View File

@ -0,0 +1,6 @@
---
features:
- novaclient now adds information about itself to the keystoneauth
user-agent. Adding information about wrapping libraries or consuming
applications can be found at
https://docs.openstack.org/developer/python-novaclient/api.html