if ! diff -u ${TEMPDIR}/${CFGFILE_NAME} ${CFGFILE}
then
echo "${0##*/}: ${PROJECT_NAME}.conf.sample is not up to date."
- echo "${0##*/}: Please run ${0%%${0##*/}}generate_sample.sh."
+ echo "${0##*/}: Please run ${0%%${0##*/}}generate_sample.sh from within a VENV."
+ echo " \'source .venv/bin/activate; generate_sample.sh\'"
+ echo "OR simply run tox genconfig"
+ echo " \'tox -egenconfig\'"
exit 1
fi
#!/usr/bin/env bash
+# Generate sample configuration for your project.
+#
+# Aside from the command line flags, it also respects a config file which
+# should be named oslo.config.generator.rc and be placed in the same directory.
+#
+# You can then export the following variables:
+# CINDER_CONFIG_GENERATOR_EXTRA_MODULES: list of modules to interrogate for options.
+# CINDER_CONFIG_GENERATOR_EXTRA_LIBRARIES: list of libraries to discover.
+# CINDER_CONFIG_GENERATOR_EXCLUDED_FILES: list of files to remove from automatic listing.
+
print_hint() {
echo "Try \`${0##*/} --help' for more information." >&2
}
BASEDIR=$(cd "$BASEDIR" && pwd)
fi
-PACKAGENAME=${PACKAGENAME:-${BASEDIR##*/}}
+PACKAGENAME=${PACKAGENAME:-$(python setup.py --name)}
TARGETDIR=$BASEDIR/$PACKAGENAME
if ! [ -d $TARGETDIR ]
then
source "$RC_FILE"
fi
+for filename in ${CINDER_CONFIG_GENERATOR_EXCLUDED_FILES}; do
+ FILES="${FILES[@]/$filename/}"
+done
+
for mod in ${CINDER_CONFIG_GENERATOR_EXTRA_MODULES}; do
MODULES="$MODULES -m $mod"
done
MODULEPATH=${MODULEPATH:-$DEFAULT_MODULEPATH}
OUTPUTFILE=$OUTPUTDIR/$PACKAGENAME.conf.sample
python -m $MODULEPATH $MODULES $LIBRARIES $FILES > $OUTPUTFILE
+if [ $? != 0 ]
+then
+ echo "Can not generate $OUTPUTFILE"
+ exit 1
+fi
# Hook to allow projects to append custom config file snippets
CONCAT_FILES=$(ls $BASEDIR/tools/config/*.conf.sample 2>/dev/null)
--testr-args='^(?!.*test.*coverage).*$'
[testenv:genconfig]
-commands =
- bash tools/config/generate_sample.sh -b . -p cinder -o etc/cinder
+sitepackages = False
+envdir = {toxworkdir}/venv
+commands = {toxinidir}/tools/config/generate_sample.sh -b . -p cinder -o etc/cinder
[testenv:venv]
commands = {posargs}