diff --git a/generate_postmortem.sh b/generate_postmortem.sh index 8c80585..76e73b6 100755 --- a/generate_postmortem.sh +++ b/generate_postmortem.sh @@ -146,19 +146,6 @@ for switch in $@; do ;; *"--diagnostic-manager"*) DIAG_MANAGER=1 - EDB_CLUSTER_NAME=$($KUBECTL get cluster --all-namespaces -o=jsonpath='{.items[0].metadata.name}' 2>/dev/null) - if [[ -z "$EDB_CLUSTER_NAME" ]]; then - COLLECT_CRUNCHY=1 - SCRIPT_LOCATION="`pwd`/crunchy_gather.py" - else - COLLECT_EDB=1 - is_kubectl_cnp_plugin - SCRIPT_LOCATION="`pwd`/edb_mustgather.sh" - fi - if [[ ! -f $SCRIPT_LOCATION ]]; then - echo -e "Unable to locate script ${SCRIPT_LOCATION} in current directory. Download from GitHub repository. Exiting..." - exit 1 - fi ;; *"--diagnostic-gateway"*) DIAG_GATEWAY=1 @@ -268,6 +255,22 @@ if [[ $? -ne 0 ]]; then exit 1 fi fi + +if [[ $DIAG_MANAGER -eq 1 ]]; then + EDB_CLUSTER_NAME=$($KUBECTL get cluster --all-namespaces -o=jsonpath='{.items[0].metadata.name}' 2>/dev/null) + if [[ -z "$EDB_CLUSTER_NAME" ]]; then + COLLECT_CRUNCHY=1 + SCRIPT_LOCATION="`pwd`/crunchy_gather.py" + else + COLLECT_EDB=1 + is_kubectl_cnp_plugin + SCRIPT_LOCATION="`pwd`/edb_mustgather.sh" + fi + if [[ ! -f $SCRIPT_LOCATION ]]; then + echo -e "Unable to locate script ${SCRIPT_LOCATION} in current directory. Download from GitHub repository. Exiting..." + exit 1 + fi +fi #------------------------------------------------------------------------------------------------------ #------------------------------------------ custom functions ------------------------------------------