Shift additional_user_agent in the stack

The additional_user_agent is intended for things, such as
os-client-config, that sit somewhere in the stack between keystoneauth
and the actual client. So according to jamielennox in irc, it should be:

  app client *additional_user_agent keystoneauth requests

The current logic puts additional_user_agent between app and client,
leading to things that look like this:

  "User-Agent: v.py/1 os-client-config/1.26.1 shade/1.19.1
   keystoneauth1/2.18.0 python-requests/2.13.0 CPython/2.7.12"

Which is a bit off.

Change-Id: Iddfbeab322a39d3ba893a15aabb4c79050526451
This commit is contained in:
Monty Taylor 2017-04-12 10:19:47 -05:00 committed by Colleen Murphy
parent e1243d924b
commit c56f4f7e40
2 changed files with 4 additions and 4 deletions

View File

@ -623,14 +623,14 @@ class Session(object):
elif self.app_name:
agent.append(self.app_name)
for additional in self.additional_user_agent:
agent.append('%s/%s' % additional)
if client_name and client_version:
agent.append('%s/%s' % (client_name, client_version))
elif client_name:
agent.append(client_name)
for additional in self.additional_user_agent:
agent.append('%s/%s' % additional)
if not agent:
# NOTE(jamielennox): determine_user_agent will return an empty
# string on failure so checking for None will ensure it is only

View File

@ -1307,7 +1307,7 @@ class AdapterTest(utils.TestCase):
adap.get(url)
agent = 'ksatest/1.2.3 one/1.1.1 two/2.2.2 testclient/4.5.6'
agent = 'ksatest/1.2.3 testclient/4.5.6 one/1.1.1 two/2.2.2'
self.assertEqual(agent + ' ' + client_session.DEFAULT_USER_AGENT,
self.requests_mock.last_request.headers['User-Agent'])