cinder/tools/config/check_uptodate.sh
John Griffith 116f54dbf1 Update cinder generate_sample script
Cinder's generate sample script has fallen a
bit out of date and was no longer working properly
in local venv.

This patch updates it with a working version that
reads the rc file and makes some other updates.

Even better, we'll update the tox.ini file here so
that it actually works, and finally add some more
info to the error message when update check fails
to make is obvious how to run these appropriately.

Change-Id: I2389910d8ece6f737a9609ce4aa05263d9293e14
2014-07-15 14:04:34 -06:00

29 lines
837 B
Bash
Executable File

#!/usr/bin/env bash
PROJECT_NAME=${PROJECT_NAME:-cinder}
CFGFILE_NAME=${PROJECT_NAME}.conf.sample
if [ -e etc/${PROJECT_NAME}/${CFGFILE_NAME} ]; then
CFGFILE=etc/${PROJECT_NAME}/${CFGFILE_NAME}
elif [ -e etc/${CFGFILE_NAME} ]; then
CFGFILE=etc/${CFGFILE_NAME}
else
echo "${0##*/}: can not find config file"
exit 1
fi
TEMPDIR=`mktemp -d /tmp/${PROJECT_NAME}.XXXXXX`
trap "rm -rf $TEMPDIR" EXIT
tools/config/generate_sample.sh -b ./ -p ${PROJECT_NAME} -o ${TEMPDIR}
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 from within a VENV."
echo " \'source .venv/bin/activate; generate_sample.sh\'"
echo "OR simply run tox genconfig"
echo " \'tox -egenconfig\'"
exit 1
fi