From 2eba58adc16136e0a0d461ce2494a81688c49302 Mon Sep 17 00:00:00 2001 From: John Schwarz Date: Tue, 30 Sep 2014 15:31:11 +0300 Subject: [PATCH] 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 --- neutronclient/shell.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/neutronclient/shell.py b/neutronclient/shell.py index 51804e9aa..442eac88a 100644 --- a/neutronclient/shell.py +++ b/neutronclient/shell.py @@ -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