conf: Move consoleauth options to a group

Rename them to remove unnecessary prefixes. This allows us to remove
the final TODO.

Change-Id: Iede35bbbf0124cfc7521cb91dda323b4d425e630
Implements: bp centralize-config-options-ocata
This commit is contained in:
Stephen Finucane 2016-08-17 17:52:37 +01:00
parent f57cc519fd
commit 2640f1f47e
4 changed files with 32 additions and 16 deletions

View File

@ -16,9 +16,7 @@
from oslo_config import cfg
consoleauth_opts = [
default_opts = [
cfg.StrOpt('consoleauth_topic',
default='consoleauth',
deprecated_for_removal=True,
@ -37,25 +35,37 @@ communicate with nova-consoleauth to get a VNC console.
Possible Values:
* 'consoleauth' (default) or Any string representing topic exchange name.
* 'consoleauth' (default) or Any string representing topic exchange name.
"""),
cfg.IntOpt('console_token_ttl',
]
consoleauth_group = cfg.OptGroup(
name='consoleauth',
title='Console auth options')
consoleauth_opts = [
cfg.IntOpt('token_ttl',
default=600,
min=0,
deprecated_name='console_token_ttl',
deprecated_group='DEFAULT',
help="""
This option indicates the lifetime of a console auth token. A console auth
token is used in authorizing console access for a user. Once the auth token
time to live count has elapsed, the token is considered expired. Expired
tokens are then deleted.
The lifetime of a console auth token.
A console auth token is used in authorizing console access for a user.
Once the auth token time to live count has elapsed, the token is
considered expired. Expired tokens are then deleted.
""")
]
def register_opts(conf):
conf.register_opts(consoleauth_opts)
conf.register_opts(default_opts)
conf.register_group(consoleauth_group)
conf.register_opts(consoleauth_opts, group=consoleauth_group)
def list_opts():
# TODO(aunnam): This should be moved into the consoleauth group and
# oslo_config.cfg.OptGroup used
return {'DEFAULT': consoleauth_opts}
return {'DEFAULT': default_opts,
consoleauth_group: consoleauth_opts}

View File

@ -52,7 +52,7 @@ class ConsoleAuthManager(manager.Manager):
@property
def mc(self):
if self._mc is None:
self._mc = cache_utils.get_client(CONF.console_token_ttl)
self._mc = cache_utils.get_client(CONF.consoleauth.token_ttl)
return self._mc
@property

View File

@ -52,7 +52,7 @@ class ConsoleauthTestCase(test.NoDBTestCase):
# Test that tokens expire correctly.
self.useFixture(test.TimeOverride())
token = u'mytok'
self.flags(console_token_ttl=1)
self.flags(token_ttl=1, group='consoleauth')
self._stub_validate_console_port(True)
@ -121,7 +121,7 @@ class ConsoleauthTestCase(test.NoDBTestCase):
def test_delete_expired_tokens(self):
self.useFixture(test.TimeOverride())
token = u'mytok'
self.flags(console_token_ttl=1)
self.flags(token_ttl=1, group='consoleauth')
self._stub_validate_console_port(True)

View File

@ -0,0 +1,6 @@
---
upgrade:
- |
The ``console_token_ttl`` configuration option has been moved to the
``consoleauth`` group and renamed ``token_ttl``. It should no longer be
included in the ``DEFAULT`` group.