Use keystoneauth instead of keystoneclient

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
This commit is contained in:
Monty Taylor
2015-12-05 00:14:52 -05:00
parent 5eb008b2b8
commit a37e11f637
4 changed files with 14 additions and 16 deletions

View 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',

View 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)

View 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'))

View 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