Update Oslo config sample generator
This commit syncs the latest version of the config generator and all
it's dependency modules from oslo-incubator. The justification was
change Iee6cc05cad70963f2a151f595ac376c9338f5774 which adds the oslo
synced version of the check_uptodate script. Which among other things
does proper cleanup of the tempdirs
Change-Id: I56bdd239b328cc38a83f80d14e53cc62d4f97954
diff --git a/tools/config/generate_sample.sh b/tools/config/generate_sample.sh
index 607fecb..20ddfbb 100755
--- a/tools/config/generate_sample.sh
+++ b/tools/config/generate_sample.sh
@@ -4,8 +4,8 @@
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: -- "$@")
+PARSED_OPTIONS=$(getopt -n "${0##*/}" -o hb:p:m:l:o: \
+ --long help,base-dir:,package-name:,output-dir:,module:,library: -- "$@")
if [ $? != 0 ] ; then print_hint ; exit 1 ; fi
@@ -21,6 +21,8 @@
echo "-b, --base-dir=DIR project base directory"
echo "-p, --package-name=NAME project package name"
echo "-o, --output-dir=DIR file output directory"
+ echo "-m, --module=MOD extra python module to interrogate for options"
+ echo "-l, --library=LIB extra library that registers options for discovery"
exit 0
;;
-b|--base-dir)
@@ -38,6 +40,16 @@
OUTPUTDIR=`echo $1 | sed -e 's/\/*$//g'`
shift
;;
+ -m|--module)
+ shift
+ MODULES="$MODULES -m $1"
+ shift
+ ;;
+ -l|--library)
+ shift
+ LIBRARIES="$LIBRARIES -l $1"
+ shift
+ ;;
--)
break
;;
@@ -53,7 +65,7 @@
BASEDIR=$(cd "$BASEDIR" && pwd)
fi
-PACKAGENAME=${PACKAGENAME:-${BASEDIR##*/}}
+PACKAGENAME=${PACKAGENAME:-$(python setup.py --name)}
TARGETDIR=$BASEDIR/$PACKAGENAME
if ! [ -d $TARGETDIR ]
then
@@ -77,12 +89,20 @@
FILES=$(find $TARGETDIR -type f -name "*.py" ! -path "*/tests/*" \
-exec grep -l "Opt(" {} + | sed -e "s/^$BASEDIRESC\///g" | sort -u)
-EXTRA_MODULES_FILE="`dirname $0`/oslo.config.generator.rc"
-if test -r "$EXTRA_MODULES_FILE"
+RC_FILE="`dirname $0`/oslo.config.generator.rc"
+if test -r "$RC_FILE"
then
- source "$EXTRA_MODULES_FILE"
+ source "$RC_FILE"
fi
+for mod in ${TEMPEST_CONFIG_GENERATOR_EXTRA_MODULES}; do
+ MODULES="$MODULES -m $mod"
+done
+
+for lib in ${TEMPEST_CONFIG_GENERATOR_EXTRA_LIBRARIES}; do
+ LIBRARIES="$LIBRARIES -l $lib"
+done
+
export EVENTLET_NO_GREENDNS=yes
OS_VARS=$(set | sed -n '/^OS_/s/=[^=]*$//gp' | xargs)
@@ -90,7 +110,7 @@
DEFAULT_MODULEPATH=tempest.openstack.common.config.generator
MODULEPATH=${MODULEPATH:-$DEFAULT_MODULEPATH}
OUTPUTFILE=$OUTPUTDIR/$PACKAGENAME.conf.sample
-python -m $MODULEPATH $FILES > $OUTPUTFILE
+python -m $MODULEPATH $MODULES $LIBRARIES $FILES > $OUTPUTFILE
# Hook to allow projects to append custom config file snippets
CONCAT_FILES=$(ls $BASEDIR/tools/config/*.conf.sample 2>/dev/null)