Allow generate_sample.sh to be run from toplevel dir
I hit an issue where extract_opts.py couldn't import importutils since it's not in my sys.path, so it's clear we need to set PYTHONPATH before running. The whole business of running the tool from the tools/conf dir is fairly awkward, so change it to run from the top-level dir instead. Change-Id: I89b4d874a6ee3732234a9704a8ee6001a293ed71
This commit is contained in:
parent
9fecad9e6f
commit
46de1cc267
9
tools/conf/README
Normal file
9
tools/conf/README
Normal file
@ -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.
|
@ -41,7 +41,7 @@ OPTION_REGEX = re.compile(r"(%s)" % "|".join([STROPT, BOOLOPT, INTOPT,
|
|||||||
OPTION_HELP_INDENT = "####"
|
OPTION_HELP_INDENT = "####"
|
||||||
|
|
||||||
PY_EXT = ".py"
|
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
|
WORDWRAP_WIDTH = 60
|
||||||
|
|
||||||
|
|
||||||
@ -50,8 +50,8 @@ def main(srcfiles):
|
|||||||
'', '[DEFAULT]', ''])
|
'', '[DEFAULT]', ''])
|
||||||
mods_by_pkg = dict()
|
mods_by_pkg = dict()
|
||||||
for filepath in srcfiles:
|
for filepath in srcfiles:
|
||||||
pkg_name = filepath.split(os.sep)[3]
|
pkg_name = filepath.split(os.sep)[1]
|
||||||
mod_str = '.'.join(['.'.join(filepath.split(os.sep)[2:-1]),
|
mod_str = '.'.join(['.'.join(filepath.split(os.sep)[:-1]),
|
||||||
os.path.basename(filepath).split('.')[0]])
|
os.path.basename(filepath).split('.')[0]])
|
||||||
mods_by_pkg.setdefault(pkg_name, list()).append(mod_str)
|
mods_by_pkg.setdefault(pkg_name, list()).append(mod_str)
|
||||||
# NOTE(lzyeval): place top level modules before packages
|
# NOTE(lzyeval): place top level modules before packages
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
pushd $(cd $(dirname "$0") && pwd) >/dev/null
|
|
||||||
|
|
||||||
find ../../nova -type f -name "*.py" ! -path "../../nova/tests/*" -exec \
|
FILES=$(find nova -type f -name "*.py" ! -path "nova/tests/*" -exec \
|
||||||
grep -l "Opt(" {} \; | sort -u | xargs python extract_opts.py > \
|
grep -l "Opt(" {} \; | sort -u)
|
||||||
../../etc/nova/nova.conf.sample
|
|
||||||
|
|
||||||
popd >/dev/null
|
PYTHONPATH=./:${PYTHONPATH} \
|
||||||
|
python $(dirname "$0")/extract_opts.py ${FILES} > \
|
||||||
|
etc/nova/nova.conf.sample
|
||||||
|
Loading…
x
Reference in New Issue
Block a user