Migrate from keystoneclient to keystoneauth

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.
Migrated piece of code using keystoneclient auth sessions to
keystoneauth.

bp: keystoneclient-to-keystoneauth

Change-Id: I99f99bae8cfb7462e5a9a10f2a559bdff7219634
This commit is contained in:
Chaozhe.Chen 2015-12-10 16:57:40 +08:00 committed by Stéphane Albert
parent fe2260bfdd
commit 9fe4552a00
3 changed files with 11 additions and 12 deletions

View File

@ -16,18 +16,17 @@
# @author: Stéphane Albert
#
from ceilometerclient import client as cclient
from keystoneclient import auth as ks_auth
from keystoneclient import session as ks_session
from keystoneauth1 import loading as ks_loading
from oslo_config import cfg
from cloudkitty import collector
from cloudkitty import utils as ck_utils
CEILOMETER_COLLECTOR_OPTS = 'ceilometer_collector'
ks_session.Session.register_conf_options(
ks_loading.register_session_conf_options(
cfg.CONF,
CEILOMETER_COLLECTOR_OPTS)
ks_auth.register_conf_options(
ks_loading.register_auth_conf_options(
cfg.CONF,
CEILOMETER_COLLECTOR_OPTS)
CONF = cfg.CONF
@ -80,10 +79,10 @@ class CeilometerCollector(collector.BaseCollector):
self._cacher = CeilometerResourceCacher()
self.auth = ks_auth.load_from_conf_options(
self.auth = ks_loading.load_auth_from_conf_options(
CONF,
CEILOMETER_COLLECTOR_OPTS)
self.session = ks_session.Session.load_from_conf_options(
self.session = ks_loading.load_session_from_conf_options(
CONF,
CEILOMETER_COLLECTOR_OPTS,
auth=self.auth)

View File

@ -16,11 +16,10 @@
#
# @author: Stéphane Albert
#
from keystoneclient import auth as ks_auth
from keystoneauth1 import loading as ks_loading
from keystoneclient import client as kclient
from keystoneclient import discover
from keystoneclient import exceptions
from keystoneclient import session as ks_session
from oslo_config import cfg
import six
@ -33,10 +32,10 @@ keystone_fetcher_opts = [
help='Keystone version to use.'), ]
cfg.CONF.register_opts(keystone_fetcher_opts, KEYSTONE_FETCHER_OPTS)
ks_session.Session.register_conf_options(
ks_loading.register_session_conf_options(
cfg.CONF,
KEYSTONE_FETCHER_OPTS)
ks_auth.register_conf_options(
ks_loading.register_auth_conf_options(
cfg.CONF,
KEYSTONE_FETCHER_OPTS)
CONF = cfg.CONF
@ -46,10 +45,10 @@ class KeystoneFetcher(tenant_fetcher.BaseFetcher):
"""Keystone tenants fetcher."""
def __init__(self):
self.auth = ks_auth.load_from_conf_options(
self.auth = ks_loading.load_auth_from_conf_options(
CONF,
KEYSTONE_FETCHER_OPTS)
self.session = ks_session.Session.load_from_conf_options(
self.session = ks_loading.load_session_from_conf_options(
CONF,
KEYSTONE_FETCHER_OPTS,
auth=self.auth)

View File

@ -6,6 +6,7 @@ eventlet!=0.18.3,>=0.18.2 # MIT
keystonemiddleware!=4.1.0,>=4.0.0 # Apache-2.0
python-ceilometerclient>=2.2.1 # Apache-2.0
python-keystoneclient!=1.8.0,!=2.1.0,>=1.6.0 # Apache-2.0
keystoneauth1>=2.1.0 # Apache-2.0
iso8601>=0.1.9 # MIT
PasteDeploy>=1.5.0 # MIT
pecan>=1.0.0 # BSD