Merge "options: Remove deprecated option aliases"

This commit is contained in:
Zuul 2024-01-25 15:52:01 +00:00 committed by Gerrit Code Review
commit 2376924760
3 changed files with 18 additions and 76 deletions

View File

@ -16,15 +16,12 @@ from oslo_config import cfg
database_opts = [
cfg.BoolOpt(
'sqlite_synchronous',
deprecated_group='DEFAULT',
default=True,
help='If True, SQLite uses synchronous mode.',
),
cfg.StrOpt(
'backend',
default='sqlalchemy',
deprecated_name='db_backend',
deprecated_group='DEFAULT',
help='The back end to use for the database.',
),
cfg.StrOpt(
@ -34,11 +31,6 @@ database_opts = [
'the database.'
),
secret=True,
deprecated_opts=[
cfg.DeprecatedOpt('sql_connection', group='DEFAULT'),
cfg.DeprecatedOpt('sql_connection', group='DATABASE'),
cfg.DeprecatedOpt('connection', group='sql'),
],
),
cfg.StrOpt(
'slave_connection',
@ -89,10 +81,6 @@ database_opts = [
cfg.IntOpt(
'max_retries',
default=10,
deprecated_opts=[
cfg.DeprecatedOpt('sql_max_retries', group='DEFAULT'),
cfg.DeprecatedOpt('sql_max_retries', group='DATABASE'),
],
help=(
'Maximum number of database connection retries during startup. '
'Set to -1 to specify an infinite retry count.'
@ -101,19 +89,11 @@ database_opts = [
cfg.IntOpt(
'retry_interval',
default=10,
deprecated_opts=[
cfg.DeprecatedOpt('sql_retry_interval', group='DEFAULT'),
cfg.DeprecatedOpt('reconnect_interval', group='DATABASE'),
],
help='Interval between retries of opening a SQL connection.',
),
cfg.IntOpt(
'max_overflow',
default=50,
deprecated_opts=[
cfg.DeprecatedOpt('sql_max_overflow', group='DEFAULT'),
cfg.DeprecatedOpt('sqlalchemy_max_overflow', group='DATABASE'),
],
help='If set, use this value for max_overflow with SQLAlchemy.',
),
cfg.IntOpt(
@ -121,9 +101,6 @@ database_opts = [
default=0,
min=0,
max=100,
deprecated_opts=[
cfg.DeprecatedOpt('sql_connection_debug', group='DEFAULT')
],
help=(
'Verbosity of SQL debugging information: 0=None, '
'100=Everything.'
@ -132,16 +109,10 @@ database_opts = [
cfg.BoolOpt(
'connection_trace',
default=False,
deprecated_opts=[
cfg.DeprecatedOpt('sql_connection_trace', group='DEFAULT')
],
help='Add Python stack traces to SQL as comment strings.',
),
cfg.IntOpt(
'pool_timeout',
deprecated_opts=[
cfg.DeprecatedOpt('sqlalchemy_pool_timeout', group='DATABASE')
],
help='If set, use this value for pool_timeout with SQLAlchemy.',
),
cfg.BoolOpt(

View File

@ -26,23 +26,6 @@ class DbApiOptionsTestCase(test_base.BaseTestCase):
self.conf = self.useFixture(config_fixture.Config()).conf
self.conf.register_opts(options.database_opts, group='database')
def test_deprecated_session_parameters(self):
path = self.create_tempfiles([["tmp", b"""[DEFAULT]
sql_connection=x://y.z
sql_max_retries=30
sql_retry_interval=40
sql_max_overflow=50
sql_connection_debug=60
sql_connection_trace=True
"""]])[0]
self.conf(['--config-file', path])
self.assertEqual('x://y.z', self.conf.database.connection)
self.assertEqual(30, self.conf.database.max_retries)
self.assertEqual(40, self.conf.database.retry_interval)
self.assertEqual(50, self.conf.database.max_overflow)
self.assertEqual(60, self.conf.database.connection_debug)
self.assertEqual(True, self.conf.database.connection_trace)
def test_session_parameters(self):
path = self.create_tempfiles([["tmp", b"""[database]
connection=x://y.z
@ -64,36 +47,6 @@ pool_timeout=7
self.assertEqual(True, self.conf.database.connection_trace)
self.assertEqual(7, self.conf.database.pool_timeout)
def test_dbapi_database_deprecated_parameters(self):
path = self.create_tempfiles([['tmp', b'[DATABASE]\n'
b'sql_connection=fake_connection\n'
b'sql_max_retries=22\n'
b'reconnect_interval=17\n'
b'sqlalchemy_max_overflow=101\n'
b'sqlalchemy_pool_timeout=5\n'
]])[0]
self.conf(['--config-file', path])
self.assertEqual('fake_connection', self.conf.database.connection)
self.assertEqual(22, self.conf.database.max_retries)
self.assertEqual(17, self.conf.database.retry_interval)
self.assertEqual(101, self.conf.database.max_overflow)
self.assertEqual(5, self.conf.database.pool_timeout)
def test_dbapi_database_deprecated_parameters_sql(self):
path = self.create_tempfiles([['tmp', b'[sql]\n'
b'connection=test_sql_connection\n'
]])[0]
self.conf(['--config-file', path])
self.assertEqual('test_sql_connection', self.conf.database.connection)
def test_deprecated_dbapi_parameters(self):
path = self.create_tempfiles([['tmp', b'[DEFAULT]\n'
b'db_backend=test_123\n'
]])[0]
self.conf(['--config-file', path])
self.assertEqual('test_123', self.conf.database.backend)
def test_dbapi_parameters(self):
path = self.create_tempfiles([['tmp', b'[database]\n'
b'backend=test_123\n'

View File

@ -0,0 +1,18 @@
---
upgrade:
- |
The following deprecated option aliases have been removed:
- ``[DEFAULT] sqlite_synchronous`` (use ``[database] sqlite_synchronous``)
- ``[DEFAULT] db_backend`` (use ``[database] backend``)
- ``[DEFAULT] sql_connection``, ``[DATABASE] sql_connection``,
``[sql] connection`` (use ``[database] connection``)
- ``[DEFAULT] sql_max_retries``, ``[DATABASE] sql_max_retries``
(use ``[database] max_retries``)
- ``[DEFAULT] sql_retry_interval``, ``[DATABASE] reconnect_interval``
(use ``[database] retry_interval``)
- ``[DEFAULT] sql_max_overflow``, ``[DATABASE] sqlalchemy_max_overflow``
(use ``[database] max_overflow``)
- ``[DEFAULT] sql_connection_debug`` (use ``[database] connection_debug``)
- ``[DEFAULT] sql_connection_trace`` (use ``[database] connection_trace``)
- ``[DATABASE] sqlalchemy_pool_timeout`` (use ``[database] pool_timeout``)