From 50a253003b55d0b3d84cd1955e6054b9ced9c21e Mon Sep 17 00:00:00 2001 From: David Gillingham Date: Fri, 2 Nov 2012 11:10:08 -0500 Subject: [PATCH] Issue #1236: Add a flag to the textdb command that the automated hurricane tools can use that will force reading/writing from the practice textdb. Change-Id: I348fba095d203ac4439a611fca948ae52e2f10cc Former-commit-id: f79608ba9c62ee1bc3b0cd578c5d3f56bd2d98f0 [formerly a98e49351d61a8703e65047e0fb7cf5417485785] [formerly 927bae7c594ff649c8d35139f53ecd77b0a0c9e8] [formerly f79608ba9c62ee1bc3b0cd578c5d3f56bd2d98f0 [formerly a98e49351d61a8703e65047e0fb7cf5417485785] [formerly 927bae7c594ff649c8d35139f53ecd77b0a0c9e8] [formerly 2dd0c2477ffe173b22396012d9b028e466f14c92 [formerly 927bae7c594ff649c8d35139f53ecd77b0a0c9e8 [formerly c6df2952d9d4d3a1ff635fcc3b7208193201d33f]]]] Former-commit-id: 2dd0c2477ffe173b22396012d9b028e466f14c92 Former-commit-id: 9bb158417900be4052bf5d06468699d89fdea500 [formerly 9242fe7d4307ea5533532be5f389b8610ae3c762] [formerly 1f0325664873a925b2de5cee86385b146f61980e [formerly 78467de87130e4401396d1544f7a60ac79575462]] Former-commit-id: 12eb81e36cd5bfbcd4cf4d1d583fc8454c7d3aa5 [formerly 2072b3c8a031863b9a81984f53b4fcb26ae09e9b] Former-commit-id: f67d591be258fd236ce1b47d2c013383b19999e5 --- .../com.raytheon.uf.tools.cli/impl/textdb | 40 +++++++++++++------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/edexOsgi/com.raytheon.uf.tools.cli/impl/textdb b/edexOsgi/com.raytheon.uf.tools.cli/impl/textdb index 626a506bc2..3854cc0730 100755 --- a/edexOsgi/com.raytheon.uf.tools.cli/impl/textdb +++ b/edexOsgi/com.raytheon.uf.tools.cli/impl/textdb @@ -40,6 +40,8 @@ # updated path. # 09/28/10 6980 bkowal Updated LD_LIBRARY_PATH to # include path to python lib. +# 11/02/12 1236 dgilling Add --forcepractice flag to +# bypass test mode check. ############################################################################## # this allows you to run this script from outside of ./bin @@ -55,21 +57,35 @@ source ${RUN_FROM_DIR}/setup.env export LD_LIBRARY_PATH=${BASE_AWIPS_DIR}/src/lib:${PYTHON_INSTALL}/lib export PYTHONPATH=${RUN_FROM_DIR}/src:$PYTHONPATH -TESTCHECK="${TCMP_HOME}/bin/getTestMode" -if [ -x ${TESTCHECK} ]; then - ${TESTCHECK} - status=${?} - if [ $status -eq 11 ]; then - export OPERATIONAL_MODE="TRUE" - elif [ $status -eq 12 ]; then - export OPERATIONAL_MODE="FALSE" - elif [ $status -eq 15 ]; then - export OPERATIONAL_MODE="TRUE" +forcePractice="FALSE" +declare -a parsedArgs +for flag in $@; do + if [ $flag == "--forcepractice" ]; then + forcePractice="TRUE" + else + parsedArgs=("${parsedArgs[@]}" $flag) + fi +done + +if [ $forcePractice != "TRUE" ]; then + TESTCHECK="${TCMP_HOME}/bin/getTestMode" + if [ -x ${TESTCHECK} ]; then + ${TESTCHECK} + status=${?} + if [ $status -eq 11 ]; then + export OPERATIONAL_MODE="TRUE" + elif [ $status -eq 12 ]; then + export OPERATIONAL_MODE="FALSE" + elif [ $status -eq 15 ]; then + export OPERATIONAL_MODE="TRUE" + else + export OPERATIONAL_MODE="TRUE" + fi else export OPERATIONAL_MODE="TRUE" fi else - export OPERATIONAL_MODE="TRUE" + export OPERATIONAL_MODE="FALSE" fi # execute the textdb Python module @@ -77,5 +93,5 @@ _PYTHON="${PYTHON_INSTALL}/bin/python" _MODULE="${RUN_FROM_DIR}/src/textdb/TextDB.py" # quoting of '$@' is used to prevent command line interpretation -$_PYTHON $_MODULE "$@" +$_PYTHON $_MODULE "${parsedArgs[@]}"