diff options
| author | Mark McLoughlin <markmc@redhat.com> | 2012-01-23 11:51:14 +0000 |
|---|---|---|
| committer | Mark McLoughlin <markmc@redhat.com> | 2012-01-28 12:37:16 +0000 |
| commit | 82049af90e86380043c59741fa4e1cd2cf24aaa7 (patch) | |
| tree | fd5a35b7a373de888ece003929f8c499b34ce83c /nova/consoleauth | |
| parent | 02b872625b94c3c63674d8c64b23f80215b04a15 (diff) | |
| download | nova-82049af90e86380043c59741fa4e1cd2cf24aaa7.tar.gz nova-82049af90e86380043c59741fa4e1cd2cf24aaa7.tar.xz nova-82049af90e86380043c59741fa4e1cd2cf24aaa7.zip | |
Refactor away the flags.DEFINE_* helpers
The next obvious step in porting to cfg is to define all options using
cfg schemas directly rather than using the flags.DEFINE_* helpers.
This is a large change, but it is almost entirely pure refactoring and
does not result in any functional changes.
The only change to note is that the default values for glance_host,
glance_api_servers and default_publisher_id options are now using opt
value interpolation i.e.
-glance_host=_get_my_ip()
+glance_host='$my_ip'
-glance_api_servers=['%s:%d' % (FLAGS.glance_host, FLAGS.glance_port)]
+glance_api_servers=['$glance_host:$glance_port']
-default_publisher_id=FLAGS.host
+default_publisher_id='$host'
Also note that the lower_bound check on the {report,periodic}_interval
options are no more, but this has been true since cfg was first added.
Change-Id: Ia58c8f0aaf61628bb55b1b8485118a2a9852ed17
Diffstat (limited to 'nova/consoleauth')
| -rw-r--r-- | nova/consoleauth/__init__.py | 9 | ||||
| -rw-r--r-- | nova/consoleauth/manager.py | 17 |
2 files changed, 19 insertions, 7 deletions
diff --git a/nova/consoleauth/__init__.py b/nova/consoleauth/__init__.py index 9d578b77a..4048ae433 100644 --- a/nova/consoleauth/__init__.py +++ b/nova/consoleauth/__init__.py @@ -18,9 +18,14 @@ """Module to authenticate Consoles.""" +from nova.common import cfg from nova import flags +consoleauth_topic_opt = \ + cfg.StrOpt('consoleauth_topic', + default='consoleauth', + help='the topic console auth proxy nodes listen on') + FLAGS = flags.FLAGS -flags.DEFINE_string('consoleauth_topic', 'consoleauth', - 'the topic console auth proxy nodes listen on') +FLAGS.add_option(consoleauth_topic_opt) diff --git a/nova/consoleauth/manager.py b/nova/consoleauth/manager.py index 8f86b4b8c..08ddd5a3b 100644 --- a/nova/consoleauth/manager.py +++ b/nova/consoleauth/manager.py @@ -22,6 +22,7 @@ import os import sys import time +from nova.common import cfg from nova import flags from nova import log as logging from nova import manager @@ -29,12 +30,18 @@ from nova import utils LOG = logging.getLogger('nova.consoleauth') + +consoleauth_opts = [ + cfg.IntOpt('console_token_ttl', + default=600, + help='How many seconds before deleting tokens'), + cfg.StrOpt('consoleauth_manager', + default='nova.consoleauth.manager.ConsoleAuthManager', + help='Manager for console auth'), + ] + FLAGS = flags.FLAGS -flags.DEFINE_integer('console_token_ttl', 600, - 'How many seconds before deleting tokens') -flags.DEFINE_string('consoleauth_manager', - 'nova.consoleauth.manager.ConsoleAuthManager', - 'Manager for console auth') +FLAGS.add_options(consoleauth_opts) class ConsoleAuthManager(manager.Manager): |
