Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cluster-command - incident with arg code #22

Closed
BradleyA opened this issue Mar 28, 2019 · 1 comment
Closed

cluster-command - incident with arg code #22

BradleyA opened this issue Mar 28, 2019 · 1 comment
Assignees
Labels
bug Something isn't working, an incident requiring resources for assessment and resolution. needs investigation What? How?

Comments

@BradleyA
Copy link
Owner

Need to retest the args because it is clear that it does not work correctly

 echo -e "\nUSAGE\n   ${0} [<PREDEFINED-COMMAND>] [<CLUSTER>] [<DATA_DIR>] [SYSTEMS_FILE]"
. . . . 
if [ "$1" == "special" ] || [ "$1" == "root-special" ] ; then
    REMOTECOMMANDOPTION=${2}
    if [ "${DEBUG}" == "1" ] ; then get_date_stamp ; echo -e "${NORMAL}${DATE_STAMP} ${LOCALHOST} ${0}[$$] ${SCRIPT_VERSION} ${LINENO} ${USER} ${USER_ID}:${GROUP_ID} ${BOLD}[DEBUG]${NORMAL}  REMOTECOMMAND >${REMOTECOMMAND}<  REMOTECOMMANDOPTION >${REMOTECOMMANDOPTION}<" 1>&2 ; fi
    #       Set default
    CLUSTER="us-tx-cluster-1/"
    DATA_DIR="/usr/local/data/"
    SYSTEMS_FILE="SYSTEMS"
else
    #       Environment variable to set option for some remote commands 
    #       Order of precedence: CLI argument, environment variable, default code
    if [ $# -ge  2 ]  ; then CLUSTER=${2} ; elif [ "${CLUSTER}" == "" ] ; then CLUSTER="us-tx-cluster-1/" ; fi
    #       Order of precedence: CLI argument, environment variable, default code
    if [ $# -ge  3 ]  ; then DATA_DIR=${1} ; elif [ "${DATA_DIR}" == "" ] ; then DATA_DIR="/usr/local/data/" ; fi
    #       order of precedence: CLI argument, environment variable, default code
    if [ $# -ge  4 ]  ; then SYSTEMS_FILE=${5} ; elif [ "${SYSTEMS_FILE}" == "" ] ; then SYSTEMS_FILE="SYSTEMS" ; fi
fi
@BradleyA BradleyA added the bug Something isn't working, an incident requiring resources for assessment and resolution. label Mar 28, 2019
@BradleyA BradleyA self-assigned this Mar 28, 2019
@BradleyA BradleyA added the needs investigation What? How? label May 21, 2019
@BradleyA
Copy link
Owner Author

BradleyA commented May 26, 2019

+#       Set default
 REMOTE_COMMAND=${1:-${DEFAULT_REMOTE_COMMAND}}
+REMOTE_COMMAND_OPTION=${2:-${DEFAULT_REMOTE_COMMAND_OPTION}}
+if [ "${CLUSTER}" == "" ] ; then CLUSTER=${DEFAULT_CLUSTER} ; fi
+if [ "${DATA_DIR}" == "" ] ; then DATA_DIR=${DEFAULT_DATA_DIR} ; fi
+if [ "${SYSTEMS_FILE}" == "" ] ; then SYSTEMS_FILE=${DEFAULT_SYSTEMS_FILE} ; fi
+if [ "${DEBUG}" == "1" ] ; then get_date_stamp ; echo -e "${NORMAL}${DATE_STAMP} ${LOCALHOST} ${0}[$$] ${SCRIPT_VERSION} ${LINENO} ${USER} ${USER_ID}:${GROUP_ID} ${BOLD}[DEBUG]${NORMAL}  CLUSTER >${CLUSTER}<  DATA_DIR >${DATA_DIR}<  SYSTEMS_FILE >${SYSTEMS_FILE}< REMOTE_COMMAND >${REMOTE_COMMAND}< REMOTE_COMMAND_OPTION >${REMOTE_COMMAND_OPTION}< Number of options >$#<" 1>&2 ; fi
+ 
+if [ "$1" == "special" ] || [ "$1" == "root-special" ] && ! [ $# == "2" ] ; then
+               get_date_stamp ; echo -e "${NORMAL}${DATE_STAMP} ${LOCALHOST} ${0}[$$] ${SCRIPT_VERSION} ${LINENO} ${USER} ${USER_ID}:${GROUP_ID} ${BOLD}[ERROR]${NORMAL}  Command not found after special|root-special." 1>&2
+               exit 1
 fi
-if [ "${DEBUG}" == "1" ] ; then get_date_stamp ; echo -e "${NORMAL}${DATE_STAMP} ${LOCALHOST} ${0}[$$] ${SCRIPT_VERSION} ${LINENO} ${USER} ${USER_ID}:${GROUP_ID} ${BOLD}[DEBUG]${NORMAL}  CLUSTER >${CLUSTER}<  DATA_DIR >${DATA_DIR}<  SYSTEMS_FILE >${SYSTEMS_FILE}< REMOTE_COMMAND >${REMOTE_COMMAND}< REMOTE_COMMAND_OPTION >${REMOTE_COMMAND_OPTION}<" 1>&2 ; fi

@BradleyA BradleyA added this to Investigating in Cluster-command - R&D via automation May 24, 2020
@BradleyA BradleyA moved this from Investigating to Completed in Cluster-command - R&D May 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working, an incident requiring resources for assessment and resolution. needs investigation What? How?
Projects
Development

No branches or pull requests

1 participant