diff options
author | Jenkins <jenkins@review.openstack.org> | 2013-01-23 06:03:50 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2013-01-23 06:03:50 +0000 |
commit | 5309d3cebd27006c652981db2f64dde16aa2706f (patch) | |
tree | 7278dbe061da690e047d68f039a9b936e9724e0e | |
parent | eb368aff661bcedd5b459e0f60fb6fa7e62eb0ca (diff) | |
parent | 4a04aacef3bd537f19c66b135b8d4e7e293a4a80 (diff) | |
download | nova-5309d3cebd27006c652981db2f64dde16aa2706f.tar.gz nova-5309d3cebd27006c652981db2f64dde16aa2706f.tar.xz nova-5309d3cebd27006c652981db2f64dde16aa2706f.zip |
Merge "Cleanup of extract_opts.py"
-rw-r--r-- | tools/conf/extract_opts.py | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/tools/conf/extract_opts.py b/tools/conf/extract_opts.py index 3185cb93d..ccfcf3e4f 100644 --- a/tools/conf/extract_opts.py +++ b/tools/conf/extract_opts.py @@ -2,7 +2,6 @@ # Copyright 2012 SINA Corporation # All Rights Reserved. -# Author: Zhongyue Luo <lzyeval@gmail.com> # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain @@ -15,6 +14,9 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +# +# @author: Zhongyue Luo, SINA Corporation. +# """Extracts OpenStack config option info from module(s).""" @@ -35,6 +37,15 @@ FLOATOPT = "FloatOpt" LISTOPT = "ListOpt" MULTISTROPT = "MultiStrOpt" +OPT_TYPES = { + STROPT: 'string value', + BOOLOPT: 'boolean value', + INTOPT: 'integer value', + FLOATOPT: 'floating point value', + LISTOPT: 'list value', + MULTISTROPT: 'multi valued', +} + OPTION_COUNT = 0 OPTION_REGEX = re.compile(r"(%s)" % "|".join([STROPT, BOOLOPT, INTOPT, FLOATOPT, LISTOPT, @@ -187,33 +198,19 @@ def _get_my_ip(): return None -MY_IP = _get_my_ip() -HOST = socket.getfqdn() - - def _sanitize_default(s): """Set up a reasonably sensible default for pybasedir, my_ip and host.""" if s.startswith(BASEDIR): return s.replace(BASEDIR, '/usr/lib/python/site-packages') - elif s == MY_IP: + elif s == _get_my_ip(): return '10.0.0.1' - elif s == HOST: + elif s == socket.getfqdn(): return 'nova' elif s.strip() != s: return '"%s"' % s return s -OPT_TYPES = { - 'StrOpt': 'string value', - 'BoolOpt': 'boolean value', - 'IntOpt': 'integer value', - 'FloatOpt': 'floating point value', - 'ListOpt': 'list value', - 'MultiStrOpt': 'multi valued', -} - - def _print_opt(opt): opt_name, opt_default, opt_help = opt.dest, opt.default, opt.help if not opt_help: |