diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-08-23 20:23:09 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-08-23 20:23:09 +0000 |
| commit | 13937c028df30de8649685b471c5fbbcf634cedd (patch) | |
| tree | c97f9b11336600179b30824306f4f2f6e3dd4534 /tools | |
| parent | 87bc968f1b0546dd131683efa7e9d1a1dfcad1e7 (diff) | |
| parent | 46de1cc2674d6fe4f068054527b176d0dd98cffb (diff) | |
| download | nova-13937c028df30de8649685b471c5fbbcf634cedd.tar.gz nova-13937c028df30de8649685b471c5fbbcf634cedd.tar.xz nova-13937c028df30de8649685b471c5fbbcf634cedd.zip | |
Merge "Allow generate_sample.sh to be run from toplevel dir"
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/conf/README | 9 | ||||
| -rw-r--r-- | tools/conf/extract_opts.py | 6 | ||||
| -rwxr-xr-x | tools/conf/generate_sample.sh | 10 |
3 files changed, 17 insertions, 8 deletions
diff --git a/tools/conf/README b/tools/conf/README new file mode 100644 index 000000000..a76efb2a7 --- /dev/null +++ b/tools/conf/README @@ -0,0 +1,9 @@ +This tool is used to generate etc/nova/nova.conf.sample + +Run it from the top-level working directory i.e. + + $> ./tools/conf/generate_sample.sh + +Watch out for warnings about modules like libvirt, qpid and zmq not +being found - these warnings are significant because they result +in options not appearing in the generated config file. diff --git a/tools/conf/extract_opts.py b/tools/conf/extract_opts.py index ed4ad55aa..42fac6969 100644 --- a/tools/conf/extract_opts.py +++ b/tools/conf/extract_opts.py @@ -41,7 +41,7 @@ OPTION_REGEX = re.compile(r"(%s)" % "|".join([STROPT, BOOLOPT, INTOPT, OPTION_HELP_INDENT = "####" PY_EXT = ".py" -BASEDIR = os.path.abspath(os.path.dirname(__file__) + "../../") +BASEDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "../../")) WORDWRAP_WIDTH = 60 @@ -52,8 +52,8 @@ def main(srcfiles): cfg.__name__ + ':' + cfg.CommonConfigOpts.__name__) mods_by_pkg = dict() for filepath in srcfiles: - pkg_name = filepath.split(os.sep)[3] - mod_str = '.'.join(['.'.join(filepath.split(os.sep)[2:-1]), + pkg_name = filepath.split(os.sep)[1] + mod_str = '.'.join(['.'.join(filepath.split(os.sep)[:-1]), os.path.basename(filepath).split('.')[0]]) mods_by_pkg.setdefault(pkg_name, list()).append(mod_str) # NOTE(lzyeval): place top level modules before packages diff --git a/tools/conf/generate_sample.sh b/tools/conf/generate_sample.sh index 2a6b17aa4..25462caa2 100755 --- a/tools/conf/generate_sample.sh +++ b/tools/conf/generate_sample.sh @@ -16,10 +16,10 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -pushd $(cd $(dirname "$0") && pwd) >/dev/null -find ../../nova -type f -name "*.py" ! -path "../../nova/tests/*" -exec \ - grep -l "Opt(" {} \; | sort -u | xargs python extract_opts.py > \ - ../../etc/nova/nova.conf.sample +FILES=$(find nova -type f -name "*.py" ! -path "nova/tests/*" -exec \ + grep -l "Opt(" {} \; | sort -u) -popd >/dev/null +PYTHONPATH=./:${PYTHONPATH} \ + python $(dirname "$0")/extract_opts.py ${FILES} > \ + etc/nova/nova.conf.sample |
