Sync sample config file generator with Oslo
The sample generator tool in Oslo is located in tools/config therefore this patch moves the files in tools/conf to tools/config. The reason Oslo chose 'config' is because the generator.py module is located in the openstack.common.config package and update.py looks for the corresponding directory in tools when it syncs the 'config' package. ./update.sh --module config --base nova --dest-dir $NOVA_HOME --nodep Since every thing moved to tools/config, changes had to happen on the tox.ini file and check_update.sh Change-Id: Icbd467888cc7f16fa3694ed2b93548d0285461b5
This commit is contained in:
7 changed files with 81 additions and 41 deletions
@@ -1,9 +0,0 @@
#!/bin/sh
TMPFILE=`mktemp`
trap "rm -f ${TMPFILE}" EXIT
tools/conf/generate_sample.sh "${TMPFILE}"
if ! diff "${TMPFILE}" etc/nova/nova.conf.sample
then
echo "E: nova.conf.sample is not up to date, please run tools/conf/generate_sample.sh"
exit 42
fi
@@ -1,29 +0,0 @@
#!/usr/bin/env bash
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 SINA Corporation
# All Rights Reserved.
#
# 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
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# 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, Intel Corporation.
#
FILES=$(find nova -type f -name "*.py" ! -path "nova/tests/*" \
-exec grep -l "Opt(" {} + | sort -u)
export EVENTLET_NO_GREENDNS=yes
MODULEPATH=$(dirname "0ドル")/../../nova/openstack/common/config/generator.py
OUTPUTPATH=${1:-etc/nova/nova.conf.sample}
PYTHONPATH=./:${PYTHONPATH} python $MODULEPATH $FILES > $OUTPUTPATH
@@ -2,7 +2,7 @@ This generate_sample.sh 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
$> ./tools/config/generate_sample.sh
Watch out for warnings about modules like libvirt, qpid and zmq not
being found - these warnings are significant because they result
@@ -16,5 +16,5 @@ The tool also identifies any options which are set to the default value.
Run it from the top-level working directory i.e.
$> ./tools/conf/analyze_opts.py
$> ./tools/config/analyze_opts.py
9
tools/config/check_uptodate.sh
Executable file
9
tools/config/check_uptodate.sh
Executable file
@@ -0,0 +1,9 @@
#!/bin/sh
TEMPDIR=`mktemp -d`
CFGFILE=nova.conf.sample
tools/config/generate_sample.sh -b ./ -p nova -o $TEMPDIR
if ! diff $TEMPDIR/$CFGFILE etc/nova/$CFGFILE
then
echo "E: nova.conf.sample is not up to date, please run tools/config/generate_sample.sh"
exit 42
fi
69
tools/config/generate_sample.sh
Executable file
69
tools/config/generate_sample.sh
Executable file
@@ -0,0 +1,69 @@
#!/usr/bin/env bash
print_hint() {
echo "Try \`${0##*/} --help' for more information." >&2
}
PARSED_OPTIONS=$(getopt -n "${0##*/}" -o hb:p:o: \
--long help,base-dir:,package-name:,output-dir: -- "$@")
if [ $? != 0 ] ; then print_hint ; exit 1 ; fi
eval set -- "$PARSED_OPTIONS"
while true; do
case "1ドル" in
-h|--help)
echo "${0##*/} [options]"
echo ""
echo "options:"
echo "-h, --help show brief help"
echo "-b, --base-dir=DIR Project base directory (required)"
echo "-p, --package-name=NAME Project package name"
echo "-o, --output-dir=DIR File output directory"
exit 0
;;
-b|--base-dir)
shift
BASEDIR=`echo 1ドル | sed -e 's/\/*$//g'`
shift
;;
-p|--package-name)
shift
PACKAGENAME=`echo 1ドル`
shift
;;
-o|--output-dir)
shift
OUTPUTDIR=`echo 1ドル | sed -e 's/\/*$//g'`
shift
;;
--)
break
;;
esac
done
if [ -z $BASEDIR ] || ! [ -d $BASEDIR ]
then
echo "${0##*/}: missing project base directory" >&2 ; print_hint ; exit 1
fi
PACKAGENAME=${PACKAGENAME:-${BASEDIR##*/}}
OUTPUTDIR=${OUTPUTDIR:-$BASEDIR/etc}
if ! [ -d $OUTPUTDIR ]
then
echo "${0##*/}: cannot access \`$OUTPUTDIR': No such file or directory" >&2
exit 1
fi
BASEDIRESC=`echo $BASEDIR | sed -e 's/\//\\\\\//g'`
FILES=$(find $BASEDIR/$PACKAGENAME -type f -name "*.py" ! -path "*/tests/*" \
-exec grep -l "Opt(" {} + | sed -e "s/^$BASEDIRESC\///g" | sort -u)
export EVENTLET_NO_GREENDNS=yes
MODULEPATH=nova.openstack.common.config.generator
OUTPUTFILE=$OUTPUTDIR/$PACKAGENAME.conf.sample
python -m $MODULEPATH $FILES > $OUTPUTFILE
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.