Skip to content

Commit 85ba013

Browse files
committed
fix(gather_gitops.sh): Handle no csv,sub,ip explicitly
Signed-off-by: Oliver Gondža <[email protected]>
1 parent 490ce44 commit 85ba013

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

gather_gitops.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,11 @@ while read -r NAMESPACE; do
7373
oc adm inspect --dest-dir=${LOGS_DIR} "ns/$NAMESPACE" > /dev/null
7474
echo "gather_gitops:$LINENO] inspecting csv,sub,ip for namespace $NAMESPACE .." | tee -a ${LOGS_DIR}/gather_gitops.log
7575
readarray -t CSVS_SUBS_IPS < <(oc get --ignore-not-found clusterserviceversions.operators.coreos.com,installplans.operators.coreos.com,subscriptions.operators.coreos.com -o name -n "$NAMESPACE")
76-
oc adm inspect --dest-dir=${LOGS_DIR} "${CSVS_SUBS_IPS[@]}" -n "$NAMESPACE" &> /dev/null \
77-
|| echo "gather_gitops:$LINENO] no csv,sub,ip found in namespace $NAMESPACE .." | tee -a ${LOGS_DIR}/gather_gitops.log
76+
if [ "${#CSVS_SUBS_IPS[@]}" -eq 0 ]; then
77+
echo "gather_gitops:$LINENO] no csv,sub,ip found in namespace $NAMESPACE .." | tee -a ${LOGS_DIR}/gather_gitops.log
78+
else
79+
oc adm inspect --dest-dir=${LOGS_DIR} "${CSVS_SUBS_IPS[@]}" -n "$NAMESPACE" &> /dev/null
80+
fi
7881
done
7982

8083
# Inspecting namespace managed by ArgoCD

0 commit comments

Comments
 (0)