Add novaclient client_name and client_version to user-agent
keystoneauth supports setting additional info into the user-agent string about what the client is. Set it so that novaclient shows up in server logs as the client. Change-Id: I084a16f5372ec7df598505e9f925a70d26d66f69
This commit is contained in:
parent
6182a01998
commit
92665dbcd8
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
Loading…
Reference in New Issue
Block a user