From c81c767152d0e815c5b8b02b6ec6f2bcd1d0a8a2 Mon Sep 17 00:00:00 2001 From: Marc Koderer Date: Thu, 17 Dec 2015 12:10:12 +0100 Subject: [PATCH] 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 --- run_tempest.sh | 18 +----------------- tempest/config.py | 7 +++++++ 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/run_tempest.sh b/run_tempest.sh index a704684821..8c8f25f5ef 100755 --- a/run_tempest.sh +++ b/run_tempest.sh @@ -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 diff --git a/tempest/config.py b/tempest/config.py index a6212fb123..b86e82e605 100644 --- a/tempest/config.py +++ b/tempest/config.py @@ -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)