From 82049af90e86380043c59741fa4e1cd2cf24aaa7 Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Mon, 23 Jan 2012 11:51:14 +0000 Subject: 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 --- nova/image/s3.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'nova/image') diff --git a/nova/image/s3.py b/nova/image/s3.py index e73364a42..ee11c163c 100644 --- a/nova/image/s3.py +++ b/nova/image/s3.py @@ -31,6 +31,7 @@ import eventlet from nova import rpc import nova.db.api +from nova.common import cfg from nova import exception from nova import flags from nova import image @@ -40,13 +41,21 @@ from nova.api.ec2 import ec2utils LOG = logging.getLogger("nova.image.s3") + +s3_opts = [ + cfg.StrOpt('image_decryption_dir', + default='/tmp', + help='parent dir for tempdir used for image decryption'), + cfg.StrOpt('s3_access_key', + default='notchecked', + help='access key to use for s3 server for images'), + cfg.StrOpt('s3_secret_key', + default='notchecked', + help='secret key to use for s3 server for images'), + ] + FLAGS = flags.FLAGS -flags.DEFINE_string('image_decryption_dir', '/tmp', - 'parent dir for tempdir used for image decryption') -flags.DEFINE_string('s3_access_key', 'notchecked', - 'access key to use for s3 server for images') -flags.DEFINE_string('s3_secret_key', 'notchecked', - 'secret key to use for s3 server for images') +FLAGS.add_options(s3_opts) class S3ImageService(object): -- cgit