adding neutron to sessions module

this change adds neutron to the sessions module and updates the neutron
client to use sessions and auth plugins. it also adjust the ssh_remote
module to not pass the endpoint url as this will be determined by the
session.

* adding neutron to sessions module
* updating neutron client to use sessions and auth plugin
* removing endpoint url discovery for neutron from ssh_remote
* adding neutron to session tests
* fixing neutron client tests
* fixing ssh_remote tests
* renaming token_auth function in keystone to make it more public

Change-Id: Icaa71a06d36c6828366f8d322ec3bed3e238506b
Partial-Implements: blueprint keystone-sessions
This commit is contained in:
Michael McCune
2015-08-25 11:30:40 -04:00
parent 5466269460
commit 6a2a028c8c
7 changed files with 81 additions and 54 deletions

View File

@@ -30,6 +30,7 @@ _SESSION_CACHE = None
SESSION_TYPE_CINDER = 'cinder'
SESSION_TYPE_GENERIC = 'generic'
SESSION_TYPE_KEYSTONE = 'keystone'
SESSION_TYPE_NEUTRON = 'neutron'
SESSION_TYPE_NOVA = 'nova'
@@ -59,6 +60,7 @@ class SessionCache(object):
SESSION_TYPE_CINDER: self.get_cinder_session,
SESSION_TYPE_GENERIC: self.get_generic_session,
SESSION_TYPE_KEYSTONE: self.get_keystone_session,
SESSION_TYPE_NEUTRON: self.get_neutron_session,
SESSION_TYPE_NOVA: self.get_nova_session,
}
@@ -120,6 +122,17 @@ class SessionCache(object):
self._set_session(SESSION_TYPE_KEYSTONE, session)
return session
def get_neutron_session(self):
session = self._sessions.get(SESSION_TYPE_NEUTRON)
if not session:
if CONF.neutron.ca_file:
session = keystone.Session(cert=CONF.neutron.ca_file,
verify=CONF.neutron.api_insecure)
else:
session = self.get_generic_session()
self._set_session(SESSION_TYPE_NEUTRON, session)
return session
def get_nova_session(self):
session = self._sessions.get(SESSION_TYPE_NOVA)
if not session: