]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Use keystoneauth instead of keystoneclient
authorMonty Taylor <mordred@inaugust.com>
Sat, 5 Dec 2015 05:14:52 +0000 (00:14 -0500)
committerMonty Taylor <mordred@inaugust.com>
Sun, 6 Dec 2015 15:09:42 +0000 (15:09 +0000)
keystoneauth was split out last cycle as a library specifically to deal
with doing auth functions so that people who do not need to do keystone
CRUD operations can just consume only the auth session parts. As part
of modernizing keystone interactions, use keystoneauth instead of
keystoneclient.

Depends-On: I1f754a9a949ef92f4e427a91bbd1b1e73e86c8c4
Change-Id: Ia6fb7d8bb07d3101cf1b1afc318f3dcac0a37afc

neutron/common/config.py
neutron/notifiers/nova.py
neutron/opts.py
requirements.txt

index ac45d308283a6655e35355aac2cab36b0ffff152..bdced5ca846ab401a3fed90b999a9acdbce33e9e 100644 (file)
@@ -19,8 +19,7 @@ Routines for configuring Neutron
 
 import sys
 
-from keystoneclient import auth
-from keystoneclient import session as ks_session
+from keystoneauth1 import loading as ks_loading
 from oslo_config import cfg
 from oslo_db import options as db_options
 from oslo_log import log as logging
@@ -198,8 +197,8 @@ set_db_defaults()
 
 NOVA_CONF_SECTION = 'nova'
 
-ks_session.Session.register_conf_options(cfg.CONF, NOVA_CONF_SECTION)
-auth.register_conf_options(cfg.CONF, NOVA_CONF_SECTION)
+ks_loading.register_auth_conf_options(cfg.CONF, NOVA_CONF_SECTION)
+ks_loading.register_session_conf_options(cfg.CONF, NOVA_CONF_SECTION)
 
 nova_opts = [
     cfg.StrOpt('region_name',
index 502085277d2986e42380881c8a27e7bd6f361971..2f9cfabb2ccf6e296fdfe64f2fe6fe4eefe2f4b2 100644 (file)
@@ -13,8 +13,7 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-from keystoneclient import auth as ks_auth
-from keystoneclient import session as ks_session
+from keystoneauth1 import loading as ks_loading
 from novaclient import client as nova_client
 from novaclient import exceptions as nova_exceptions
 from oslo_config import cfg
@@ -47,11 +46,12 @@ class Notifier(object):
         # and each Notifier is handling it's own auth. That means that we are
         # authenticating the exact same thing len(controllers) times. This
         # should be an easy thing to optimize.
-        auth = ks_auth.load_from_conf_options(cfg.CONF, 'nova')
+        auth = ks_loading.load_auth_from_conf_options(cfg.CONF, 'nova')
 
-        session = ks_session.Session.load_from_conf_options(cfg.CONF,
-                                                            'nova',
-                                                            auth=auth)
+        session = ks_loading.load_session_from_conf_options(
+            cfg.CONF,
+            'nova',
+            auth=auth)
 
         extensions = [
             ext for ext in nova_client.discover_extensions(NOVA_API_VERSION)
index 70529b674b1548159cbe2ebdfa69aa6f94ad39bc..200839369bc5b43ff27327a0421f186a30479221 100644 (file)
@@ -14,8 +14,7 @@ import copy
 import itertools
 import operator
 
-from keystoneclient import auth
-from keystoneclient import session
+from keystoneauth1 import loading as ks_loading
 from oslo_config import cfg
 
 import neutron.agent.common.config
@@ -69,7 +68,7 @@ deprecations = {'nova.cafile': [cfg.DeprecatedOpt('ca_certificates_file',
                 'nova.timeout': [cfg.DeprecatedOpt('url_timeout',
                                                    group=NOVA_GROUP)]}
 
-_nova_options = session.Session.register_conf_options(
+_nova_options = ks_loading.register_session_conf_options(
             CONF, NOVA_GROUP, deprecated_opts=deprecations)
 
 
@@ -275,12 +274,12 @@ def list_sriov_agent_opts():
 
 def list_auth_opts():
     opt_list = copy.deepcopy(_nova_options)
-    opt_list.insert(0, auth.get_common_conf_options()[0])
+    opt_list.insert(0, ks_loading.get_auth_common_conf_options()[0])
     # NOTE(mhickey): There are a lot of auth plugins, we just generate
     # the config options for a few common ones
     plugins = ['password', 'v2password', 'v3password']
     for name in plugins:
-        for plugin_option in auth.get_plugin_class(name).get_options():
+        for plugin_option in ks_loading.get_plugin_loader(name).get_options():
             if all(option.name != plugin_option.name for option in opt_list):
                 opt_list.append(plugin_option)
     opt_list.sort(key=operator.attrgetter('name'))
index 2f2f1b7b3f66cd5fb0b2d8a2d5bf8b5d38a81ca5..eb984cd9eed1cec0d5830ae7c661f805140f3f64 100644 (file)
@@ -21,7 +21,7 @@ retrying!=1.3.0,>=1.2.3 # Apache-2.0
 ryu>=3.23.2 # Apache-2.0
 SQLAlchemy<1.1.0,>=0.9.9
 WebOb>=1.2.3
-python-keystoneclient!=1.8.0,>=1.6.0
+keystoneauth1>=2.1.0
 alembic>=0.8.0
 six>=1.9.0
 stevedore>=1.5.0 # Apache-2.0