Get rid of unused env variable

TEMPEST_LOG_CONFIG was never interpreted within tempest.
As a result logging.conf was only interpreted if log_config_append
in tempest.conf was set manually.

Logging properties are important for tempest CLI to ensure
the user sees some output.

Change-Id: I2bcf386b9dd2afd78ed81fd62fcc54e9b63ddeab
Partial-Bug: #1527142
This commit is contained in:
Marc Koderer 2015-12-17 12:10:12 +01:00
parent 7deeeafcb5
commit c81c767152
2 changed files with 8 additions and 17 deletions

View File

@ -14,8 +14,6 @@ function usage {
echo " -C, --config Config file location"
echo " -h, --help Print this usage message"
echo " -d, --debug Run tests with testtools instead of testr. This allows you to use PDB"
echo " -l, --logging Enable logging"
echo " -L, --logging-config Logging config file location. Default is etc/logging.conf"
echo " -- [TESTROPTIONS] After the first '--' you can pass arbitrary arguments to testr "
}
@ -31,10 +29,8 @@ force=0
wrapper=""
config_file=""
update=0
logging=0
logging_config=etc/logging.conf
if ! options=$(getopt -o VNnfusthdC:lL: -l virtual-env,no-virtual-env,no-site-packages,force,update,smoke,serial,help,debug,config:,logging,logging-config: -- "$@")
if ! options=$(getopt -o VNnfusthdC:lL: -l virtual-env,no-virtual-env,no-site-packages,force,update,smoke,serial,help,debug,config: -- "$@")
then
# parse error
usage
@ -55,8 +51,6 @@ while [ $# -gt 0 ]; do
-C|--config) config_file=$2; shift;;
-s|--smoke) testrargs+="smoke";;
-t|--serial) serial=1;;
-l|--logging) logging=1;;
-L|--logging-config) logging_config=$2; shift;;
--) [ "yes" == "$first_uu" ] || testrargs="$testrargs $1"; first_uu=no ;;
*) testrargs="$testrargs $1";;
esac
@ -69,16 +63,6 @@ if [ -n "$config_file" ]; then
export TEMPEST_CONFIG=`basename "$config_file"`
fi
if [ $logging -eq 1 ]; then
if [ ! -f "$logging_config" ]; then
echo "No such logging config file: $logging_config"
exit 1
fi
logging_config=`readlink -f "$logging_config"`
export TEMPEST_LOG_CONFIG_DIR=`dirname "$logging_config"`
export TEMPEST_LOG_CONFIG=`basename "$logging_config"`
fi
cd `dirname "$0"`
if [ $no_site_packages -eq 1 ]; then

View File

@ -1436,6 +1436,13 @@ class TempestConfigPrivate(object):
_CONF([], project='tempest', default_config_files=config_files)
else:
_CONF([], project='tempest')
logging_cfg_path = "%s/logging.conf" % os.path.dirname(path)
if (not hasattr(_CONF, 'log_config_append') and
os.path.isfile(logging_cfg_path)):
# if logging conf is in place we need to set log_config_append
_CONF.log_config_append = logging_cfg_path
logging.setup(_CONF, 'tempest')
LOG = logging.getLogger('tempest')
LOG.info("Using tempest config file %s" % path)