Pass configured auth strategy to neutronclient

When the token is invalid Nova emits a log trace about an
unknown auth strategy (caused by neutron client). This is a
red herring and is only masking the fact that the token was
unable to be validated in the first place.

Partial-bug: 1297309

Change-Id: Ia3801f80c7ca18674fcf46b5270aa04f6c8c9331
This commit is contained in:
armando-migliaccio 2014-03-25 08:43:31 -07:00 committed by Gerrit Code Review
parent a03a9779bc
commit fdd689c146
2 changed files with 3 additions and 4 deletions

View File

@ -30,11 +30,11 @@ def _get_client(token=None):
'timeout': CONF.neutron_url_timeout, 'timeout': CONF.neutron_url_timeout,
'insecure': CONF.neutron_api_insecure, 'insecure': CONF.neutron_api_insecure,
'ca_cert': CONF.neutron_ca_certificates_file, 'ca_cert': CONF.neutron_ca_certificates_file,
'auth_strategy': CONF.neutron_auth_strategy,
} }
if token: if token:
params['token'] = token params['token'] = token
params['auth_strategy'] = None
else: else:
params['username'] = CONF.neutron_admin_username params['username'] = CONF.neutron_admin_username
if CONF.neutron_admin_tenant_id: if CONF.neutron_admin_tenant_id:
@ -43,7 +43,6 @@ def _get_client(token=None):
params['tenant_name'] = CONF.neutron_admin_tenant_name params['tenant_name'] = CONF.neutron_admin_tenant_name
params['password'] = CONF.neutron_admin_password params['password'] = CONF.neutron_admin_password
params['auth_url'] = CONF.neutron_admin_auth_url params['auth_url'] = CONF.neutron_admin_auth_url
params['auth_strategy'] = CONF.neutron_auth_strategy
return clientv20.Client(**params) return clientv20.Client(**params)

View File

@ -100,7 +100,7 @@ class TestNeutronClient(test.TestCase):
auth_token='token') auth_token='token')
self.mox.StubOutWithMock(client.Client, "__init__") self.mox.StubOutWithMock(client.Client, "__init__")
client.Client.__init__( client.Client.__init__(
auth_strategy=None, auth_strategy=CONF.neutron_auth_strategy,
endpoint_url=CONF.neutron_url, endpoint_url=CONF.neutron_url,
token=my_context.auth_token, token=my_context.auth_token,
timeout=CONF.neutron_url_timeout, timeout=CONF.neutron_url_timeout,
@ -124,7 +124,7 @@ class TestNeutronClient(test.TestCase):
is_admin=True) is_admin=True)
self.mox.StubOutWithMock(client.Client, "__init__") self.mox.StubOutWithMock(client.Client, "__init__")
client.Client.__init__( client.Client.__init__(
auth_strategy=None, auth_strategy=CONF.neutron_auth_strategy,
endpoint_url=CONF.neutron_url, endpoint_url=CONF.neutron_url,
token=my_context.auth_token, token=my_context.auth_token,
timeout=CONF.neutron_url_timeout, timeout=CONF.neutron_url_timeout,