X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fopenstack-cleanup-orphaned-stacks.sh;h=8140adea55368940b7409b19015221dcec8e499c;hb=2a10c83b2d506008cc6c01c134515fb6328e1f3a;hp=8f1851e19832b941be4f58ed71d4187907fba8e3;hpb=0b174473134b72965f9642a32d24dc43279a014a;p=releng%2Fglobal-jjb.git diff --git a/shell/openstack-cleanup-orphaned-stacks.sh b/shell/openstack-cleanup-orphaned-stacks.sh index 8f1851e1..8140adea 100644 --- a/shell/openstack-cleanup-orphaned-stacks.sh +++ b/shell/openstack-cleanup-orphaned-stacks.sh @@ -25,7 +25,13 @@ stack_in_jenkins() { JENKINS_URL="$jenkins/computer/api/json?tree=computer[executors[currentExecutable[url]],oneOffExecutors[currentExecutable[url]]]&xpath=//url&wrapper=builds" resp=$(curl -s -w "\\n\\n%{http_code}" --globoff -H "Content-Type:application/json" "$JENKINS_URL") json_data=$(echo "$resp" | head -n1) - #status=$(echo "$resp" | awk 'END {print $NF}') + status=$(echo "$resp" | awk 'END {print $NF}') + + if [ "$status" != 200 ]; then + >&2 echo "ERROR: Failed to fetch data from $JENKINS_URL with status code $status" + >&2 echo "$resp" + exit 1 + fi if [[ "${jenkins}" == *"jenkins."*".org" ]] || [[ "${jenkins}" == *"jenkins."*".io" ]]; then silo="production"