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
This commit is contained in:
Mark McLoughlin
2012-01-23 11:51:14 +00:00
parent 02b872625b
commit 82049af90e
79 changed files with 1854 additions and 1158 deletions

View File

@@ -44,15 +44,20 @@ import urllib
import routes
import webob
from nova.common import cfg
from nova import flags
from nova import log as logging
from nova import utils
from nova import wsgi
buckets_path_opt = \
cfg.StrOpt('buckets_path',
default='$state_path/buckets',
help='path to s3 buckets')
FLAGS = flags.FLAGS
flags.DEFINE_string('buckets_path', '$state_path/buckets',
'path to s3 buckets')
FLAGS.add_option(buckets_path_opt)
def get_wsgi_server():