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/check_uptodate.sh b/tools/config/check_uptodate.sh
index 45c8629..528bd5b 100755
--- a/tools/config/check_uptodate.sh
+++ b/tools/config/check_uptodate.sh
@@ -1,10 +1,25 @@
-#!/bin/sh
-TEMPDIR=`mktemp -d`
-CFGFILE=tempest.conf.sample
-tools/config/generate_sample.sh -b ./ -p tempest -o $TEMPDIR
-if ! diff $TEMPDIR/$CFGFILE etc/$CFGFILE
+#!/usr/bin/env bash
+
+PROJECT_NAME=${PROJECT_NAME:-tempest}
+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 "E: tempest.conf.sample is not up to date, please run:"
- echo "tools/generate_sample.sh"
- exit 42
+ echo "${0##*/}: ${PROJECT_NAME}.conf.sample is not up to date."
+ echo "${0##*/}: Please run ${0%%${0##*/}}generate_sample.sh."
+ exit 1
fi