From 3078ace8536c9b1320d9262cab30208a4ace807a Mon Sep 17 00:00:00 2001 From: David Huber Date: Fri, 24 Jan 2025 09:15:29 -0600 Subject: [PATCH] Address shellcheck issues --- parm/globus/run_doorman.sh.j2 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/parm/globus/run_doorman.sh.j2 b/parm/globus/run_doorman.sh.j2 index db4b3d9d42..41e09c42b7 100644 --- a/parm/globus/run_doorman.sh.j2 +++ b/parm/globus/run_doorman.sh.j2 @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -eu # This script runs on Niagara to interact with the Doorman service subdir="{{PSLOT}}/{{RUN}}/{{jobid}}" @@ -40,7 +41,7 @@ fi # Parse the FLIST file created by receive.sh to get the transfer IDs IDs="" while IFS= read -r line; do - package_name=$(grep -o "package_location_.*\.tgz") + package_name=$(echo "${line}" | grep -o "package_location_.*\.tgz") tmp="${package_name#package_location_}" ID="${tmp%.tgz}" IDs="${IDs} ${ID}" @@ -55,6 +56,7 @@ for ID in ${IDs}; do done # Send the acknowledgement back to the sender +set +e send.sh stat=$? @@ -63,10 +65,12 @@ if [[ ${stat} -ne 0 ]]; then echo "Failed to send status back to client!" exit 3 fi +set -e # Remove the working directory +#shellcheck ignore=SC2050 if [[ "{{KEEPDATA}}" == "NO" ]]; then - cd "${HOME}" + cd "${HOME}" || echo "Failed to navigate to ${HOME}!" && exit 4 rm -rf "${doorman_dir}" fi