diff --git a/src/pybind/mgr/ansible/run-tox.sh b/src/pybind/mgr/ansible/run-tox.sh index 88f0f18ee6e..5f215cd5fbc 100644 --- a/src/pybind/mgr/ansible/run-tox.sh +++ b/src/pybind/mgr/ansible/run-tox.sh @@ -1,9 +1,16 @@ #!/usr/bin/env bash +function dump_envvars { + echo "WITH_PYTHON2: ->$WITH_PYTHON2<-" + echo "WITH_PYTHON3: ->$WITH_PYTHON3<-" + echo "TOX_PATH: ->$TOX_PATH<-" + echo "ENV_LIST: ->$ENV_LIST<-" +} + # run from ./ or from ../ : ${MGR_ANSIBLE_VIRTUALENV:=$CEPH_BUILD_DIR/mgr-ansible-virtualenv} : ${WITH_PYTHON2:=ON} -: ${WITH_PYTHON3:=ON} +: ${WITH_PYTHON3:=3} : ${CEPH_BUILD_DIR:=$PWD/.tox} test -d ansible && cd ansible @@ -20,10 +27,15 @@ export CEPH_BUILD_DIR=$CEPH_BUILD_DIR source ${MGR_ANSIBLE_VIRTUALENV}/bin/activate if [ "$WITH_PYTHON2" = "ON" ]; then - ENV_LIST+="py27" + ENV_LIST+="py27," fi -if [ "$WITH_PYTHON3" = "ON" ]; then - ENV_LIST+="py3" +if [ "$WITH_PYTHON3" = "3" ]; then + ENV_LIST+="py3," fi +# use bash string manipulation to strip off any trailing comma +ENV_LIST=${ENV_LIST%,} -tox -c ${TOX_PATH} -e ${ENV_LIST} +tox -c "${TOX_PATH}" -e "${ENV_LIST}" +TOX_STATUS="$?" +test "$TOX_STATUS" -ne "0" && dump_envvars +exit $TOX_STATUS diff --git a/src/pybind/mgr/dashboard/run-tox.sh b/src/pybind/mgr/dashboard/run-tox.sh index 41275465649..3979a44836e 100755 --- a/src/pybind/mgr/dashboard/run-tox.sh +++ b/src/pybind/mgr/dashboard/run-tox.sh @@ -1,16 +1,23 @@ #!/usr/bin/env bash +function dump_envvars { + echo "WITH_PYTHON2: ->$WITH_PYTHON2<-" + echo "WITH_PYTHON3: ->$WITH_PYTHON3<-" + echo "TOX_PATH: ->$TOX_PATH<-" + echo "ENV_LIST: ->$ENV_LIST<-" +} + # run from ./ or from ../ : ${CEPH_BUILD_DIR:=$PWD/.tox} : ${MGR_DASHBOARD_VIRTUALENV:=$CEPH_BUILD_DIR/mgr-dashboard-virtualenv} : ${WITH_PYTHON2:=ON} -: ${WITH_PYTHON3:=ON} +: ${WITH_PYTHON3:=3} test -d dashboard && cd dashboard if [ -e tox.ini ]; then - TOX_PATH=`readlink -f tox.ini` + TOX_PATH=$(readlink -f tox.ini) else - TOX_PATH=`readlink -f $(dirname $0)/tox.ini` + TOX_PATH=$(readlink -f $(dirname $0)/tox.ini) fi # tox.ini will take care of this. @@ -26,12 +33,17 @@ if [ "$WITH_PYTHON2" = "ON" ]; then ENV_LIST+="py27-cov,py27-lint," fi fi -if [ "$WITH_PYTHON3" = "ON" ]; then +if [ "$WITH_PYTHON3" = "3" ]; then if [[ -n "$@" ]]; then - ENV_LIST+="py3-run" + ENV_LIST+="py3-run," else ENV_LIST+="py3-cov,py3-lint" fi fi +# use bash string manipulation to strip off any trailing comma +ENV_LIST=${ENV_LIST%,} -tox -c ${TOX_PATH} -e "$ENV_LIST" "$@" +tox -c "${TOX_PATH}" -e "${ENV_LIST}" +TOX_STATUS="$?" +test "$TOX_STATUS" -ne "0" && dump_envvars +exit $TOX_STATUS diff --git a/src/pybind/mgr/insights/run-tox.sh b/src/pybind/mgr/insights/run-tox.sh index 450149910b1..590ca9bee42 100644 --- a/src/pybind/mgr/insights/run-tox.sh +++ b/src/pybind/mgr/insights/run-tox.sh @@ -1,16 +1,23 @@ #!/usr/bin/env bash +function dump_envvars { + echo "WITH_PYTHON2: ->$WITH_PYTHON2<-" + echo "WITH_PYTHON3: ->$WITH_PYTHON3<-" + echo "TOX_PATH: ->$TOX_PATH<-" + echo "ENV_LIST: ->$ENV_LIST<-" +} + # run from ./ or from ../ : ${MGR_INSIGHTS_VIRTUALENV:=$CEPH_BUILD_DIR/mgr-insights-virtualenv} : ${WITH_PYTHON2:=ON} -: ${WITH_PYTHON3:=ON} +: ${WITH_PYTHON3:=3} : ${CEPH_BUILD_DIR:=$PWD/.tox} test -d insights && cd insights if [ -e tox.ini ]; then - TOX_PATH=`readlink -f tox.ini` + TOX_PATH=$(readlink -f tox.ini) else - TOX_PATH=`readlink -f $(dirname $0)/tox.ini` + TOX_PATH=$(readlink -f $(dirname $0)/tox.ini) fi # tox.ini will take care of this. @@ -20,10 +27,15 @@ export CEPH_BUILD_DIR=$CEPH_BUILD_DIR source ${MGR_INSIGHTS_VIRTUALENV}/bin/activate if [ "$WITH_PYTHON2" = "ON" ]; then - ENV_LIST+="py27" + ENV_LIST+="py27," fi -if [ "$WITH_PYTHON3" = "ON" ]; then - ENV_LIST+="py3" +if [ "$WITH_PYTHON3" = "3" ]; then + ENV_LIST+="py3," fi +# use bash string manipulation to strip off any trailing comma +ENV_LIST=${ENV_LIST%,} -tox -c ${TOX_PATH} -e ${ENV_LIST} +tox -c "${TOX_PATH}" -e "${ENV_LIST}" +TOX_STATUS="$?" +test "$TOX_STATUS" -ne "0" && dump_envvars +exit $TOX_STATUS diff --git a/src/pybind/mgr/orchestrator_cli/run-tox.sh b/src/pybind/mgr/orchestrator_cli/run-tox.sh index a7ef70ba384..d6e6f70e4c1 100644 --- a/src/pybind/mgr/orchestrator_cli/run-tox.sh +++ b/src/pybind/mgr/orchestrator_cli/run-tox.sh @@ -1,9 +1,16 @@ #!/usr/bin/env bash +function dump_envvars { + echo "WITH_PYTHON2: ->$WITH_PYTHON2<-" + echo "WITH_PYTHON3: ->$WITH_PYTHON3<-" + echo "TOX_PATH: ->$TOX_PATH<-" + echo "ENV_LIST: ->$ENV_LIST<-" +} + # run from ./ or from ../ : ${MGR_ORCHESTRATOR_CLI_VIRTUALENV:=$CEPH_BUILD_DIR/mgr-orchestrator_cli-virtualenv} : ${WITH_PYTHON2:=ON} -: ${WITH_PYTHON3:=ON} +: ${WITH_PYTHON3:=3} : ${CEPH_BUILD_DIR:=$PWD/.tox} test -d orchestrator_cli && cd orchestrator_cli @@ -23,10 +30,17 @@ then fi if [ "$WITH_PYTHON2" = "ON" ]; then - ENV_LIST+="py27" + ENV_LIST+="py27," fi -if [ "$WITH_PYTHON3" = "ON" ]; then - ENV_LIST+=",py3" +if [ "$WITH_PYTHON3" = "3" ]; then + ENV_LIST+="py3," fi +ENV_LIST=$(echo "$ENV_LIST" | sed -e 's/,$//') -tox -c ${TOX_PATH} -e ${ENV_LIST} +# use bash string manipulation to strip off any trailing comma +ENV_LIST=${ENV_LIST%,} + +tox -c "${TOX_PATH}" -e "${ENV_LIST}" +TOX_STATUS="$?" +test "$TOX_STATUS" -ne "0" && dump_envvars +exit $TOX_STATUS