From 0e001fc5976afcf918f34461c12c89ddba435857 Mon Sep 17 00:00:00 2001 From: ZhiQiang Fan Date: Tue, 19 Apr 2016 02:16:19 +0800 Subject: [PATCH] remove deprecated auth type password-aodh-legacy Change-Id: Ibb3544610ef9c6b893a11123b49b590f7001d960 --- aodh/keystone_client.py | 61 ----------------------------------------- aodh/opts.py | 2 -- aodh/service.py | 3 +- setup.cfg | 3 -- 4 files changed, 2 insertions(+), 67 deletions(-) diff --git a/aodh/keystone_client.py b/aodh/keystone_client.py index e3dca336b..b52d92d01 100644 --- a/aodh/keystone_client.py +++ b/aodh/keystone_client.py @@ -15,9 +15,7 @@ import os - from keystoneauth1 import exceptions as ka_exception -from keystoneauth1 import identity as ka_identity from keystoneauth1 import loading as ka_loading from keystoneclient.v3 import client as ks_client_v3 from oslo_config import cfg @@ -109,62 +107,3 @@ def register_keystoneauth_opts(conf): cfg.DeprecatedOpt('os-cacert', group=CFG_GROUP), cfg.DeprecatedOpt('os-cacert', group="DEFAULT")] }) - conf.set_default("auth_type", default="password-aodh-legacy", - group=CFG_GROUP) - - -def setup_keystoneauth(conf): - if conf[CFG_GROUP].auth_type == "password-aodh-legacy": - LOG.warning("Value 'password-aodh-legacy' for '[%s]/auth_type' " - "is deprecated. And will be removed in Aodh 3.0. " - "Use 'password' instead.", - CFG_GROUP) - ka_loading.load_auth_from_conf_options(conf, CFG_GROUP) - - -class LegacyAodhKeystoneLoader(ka_loading.BaseLoader): - @property - def plugin_class(self): - return ka_identity.V2Password - - def get_options(self): - options = super(LegacyAodhKeystoneLoader, self).get_options() - options.extend([ - ka_loading.Opt( - 'os-username', - default=os.environ.get('OS_USERNAME', 'aodh'), - help='User name to use for OpenStack service access.'), - ka_loading.Opt( - 'os-password', - secret=True, - default=os.environ.get('OS_PASSWORD', 'admin'), - help='Password to use for OpenStack service access.'), - ka_loading.Opt( - 'os-tenant-id', - default=os.environ.get('OS_TENANT_ID', ''), - help='Tenant ID to use for OpenStack service access.'), - ka_loading.Opt( - 'os-tenant-name', - default=os.environ.get('OS_TENANT_NAME', 'admin'), - help='Tenant name to use for OpenStack service access.'), - ka_loading.Opt( - 'os-auth-url', - default=os.environ.get('OS_AUTH_URL', - 'http://localhost:5000/v2.0'), - help='Auth URL to use for OpenStack service access.'), - ]) - return options - - def load_from_options(self, **kwargs): - options_map = { - 'os_auth_url': 'auth_url', - 'os_username': 'username', - 'os_password': 'password', - 'os_tenant_name': 'tenant_name', - 'os_tenant_id': 'tenant_id', - } - identity_kwargs = dict((options_map[o.dest], - kwargs.get(o.dest) or o.default) - for o in self.get_options() - if o.dest in options_map) - return self.plugin_class(**identity_kwargs) diff --git a/aodh/opts.py b/aodh/opts.py index bc985e57f..662fc87d6 100644 --- a/aodh/opts.py +++ b/aodh/opts.py @@ -70,8 +70,6 @@ def list_keystoneauth_opts(): # NOTE(sileht): the configuration file contains only the options # for the password plugin that handles keystone v2 and v3 API # with discovery. But other options are possible. - # Also, the default loaded plugin is password-aodh-legacy for - # backward compatibily return [('service_credentials', ( loading.get_auth_common_conf_options() + loading.get_auth_plugin_conf_options('password')))] diff --git a/aodh/service.py b/aodh/service.py index 096ae0f42..b3069e1fe 100644 --- a/aodh/service.py +++ b/aodh/service.py @@ -16,6 +16,7 @@ # under the License. import socket +from keystoneauth1 import loading as ka_loading from oslo_config import cfg from oslo_db import options as db_options import oslo_i18n @@ -65,7 +66,7 @@ def prepare_service(argv=None, config_files=None): conf(argv, project='aodh', validate_default_values=True, default_config_files=config_files) - keystone_client.setup_keystoneauth(conf) + ka_loading.load_auth_from_conf_options(conf, "service_credentials") log.setup(conf, 'aodh') messaging.setup() return conf diff --git a/setup.cfg b/setup.cfg index 7d7a02668..b395e960e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -118,9 +118,6 @@ oslo.config.opts = oslo.config.opts.defaults = aodh = aodh.conf.defaults:set_cors_middleware_defaults -keystoneauth1.plugin = - password-aodh-legacy = aodh.keystone_client:LegacyAodhKeystoneLoader - tempest.test_plugins = aodh_tests = aodh.tests.tempest.plugin:AodhTempestPlugin