remove deprecated auth type password-aodh-legacy

Change-Id: Ibb3544610ef9c6b893a11123b49b590f7001d960
This commit is contained in:
ZhiQiang Fan 2016-04-19 02:16:19 +08:00
parent b3a03e56c2
commit 0e001fc597
4 changed files with 2 additions and 67 deletions

View File

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

View File

@ -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')))]

View File

@ -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

View File

@ -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