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/cloudpipe/pipelib.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'nova/cloudpipe') diff --git a/nova/cloudpipe/pipelib.py b/nova/cloudpipe/pipelib.py index 0e86f89b1..3c92f72b1 100644 --- a/nova/cloudpipe/pipelib.py +++ b/nova/cloudpipe/pipelib.py @@ -27,6 +27,7 @@ import string import tempfile import zipfile +from nova.common import cfg from nova import context from nova import crypto from nova import db @@ -39,16 +40,20 @@ from nova.api.ec2 import cloud from nova.api.ec2 import ec2utils +cloudpipe_opts = [ + cfg.StrOpt('boot_script_template', + default=utils.abspath('cloudpipe/bootscript.template'), + help=_('Template for cloudpipe instance boot script')), + cfg.StrOpt('dmz_net', + default='10.0.0.0', + help=_('Network to push into openvpn config')), + cfg.StrOpt('dmz_mask', + default='255.255.255.0', + help=_('Netmask to push into openvpn config')), + ] + FLAGS = flags.FLAGS -flags.DEFINE_string('boot_script_template', - utils.abspath('cloudpipe/bootscript.template'), - _('Template for script to run on cloudpipe instance boot')) -flags.DEFINE_string('dmz_net', - '10.0.0.0', - _('Network to push into openvpn config')) -flags.DEFINE_string('dmz_mask', - '255.255.255.0', - _('Netmask to push into openvpn config')) +FLAGS.add_options(cloudpipe_opts) LOG = logging.getLogger('nova.cloudpipe') -- cgit