Don't get keystone session if using noauth

This patch tells neutronclient not to open an authentication session
against keystone if using --os-auth-strategy=noauth.

The intended behaviour in bp keystone-v3-api-support was that
--os-auth-strategy will be completely deprecated and that the absence
of --os-auth-url will signify that noauth is needed. This patch does
not intend to deprecate the strategy option, since that seems to be a
much larger change in the client, so a smaller fix is proposed instead.

This is needed for future Neutron integration tests which will be done
in-tree, since we don't want Neutron to depend on other projects
(including Keystone) during these tests.

Closes-bug: #1375765
Change-Id: I9c61e304f75d3d105e1d66782a7495488eefd5e2
This commit is contained in:
John Schwarz 2014-09-30 15:31:11 +03:00
parent fa5642f155
commit 2eba58adc1
1 changed files with 5 additions and 3 deletions

View File

@ -752,13 +752,15 @@ class NeutronShell(app.App):
raise exc.CommandError(
_("You must provide an auth url via"
" either --os-auth-url or via env[OS_AUTH_URL]"))
auth_session = self._get_keystone_session()
auth = auth_session.auth
else: # not keystone
if not self.options.os_url:
raise exc.CommandError(
_("You must provide a service URL via"
" either --os-url or env[OS_URL]"))
auth_session = self._get_keystone_session()
auth_session = None
auth = None
self.client_manager = clientmanager.ClientManager(
token=self.options.os_token,
@ -783,7 +785,7 @@ class NeutronShell(app.App):
retries=self.options.retries,
raise_errors=False,
session=auth_session,
auth=auth_session.auth,
auth=auth,
log_credentials=True)
return