Skip to content

Commit 490ce44

Browse files
committed
feat(gather_gitops.sh): Do not issue errors when gitops not installed
Signed-off-by: Oliver Gondža <[email protected]>
1 parent 272f170 commit 490ce44

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

gather_gitops.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ LOGS_DIR="/must-gather"
99
mkdir -p ${LOGS_DIR}
1010

1111
GITOPS_CURRENT_CSV=$(oc get subscription.operators.coreos.com --ignore-not-found -A -o json | jq '.items[] | select(.metadata.name=="openshift-gitops-operator") | .status.currentCSV' -r)
12-
readarray -t NON_ARGO_CRD_NAMES < <(oc get csv --ignore-not-found "$GITOPS_CURRENT_CSV" -o json | jq '.spec.customresourcedefinitions.owned[] | select(.name | contains("argoproj.io") | not) | .name' -rj)
12+
if [ -z "$GITOPS_CURRENT_CSV" ]; then
13+
NON_ARGO_CRD_NAMES=()
14+
else
15+
readarray -t NON_ARGO_CRD_NAMES < <(oc get csv --ignore-not-found "$GITOPS_CURRENT_CSV" -o json | jq '.spec.customresourcedefinitions.owned[] | select(.name | contains("argoproj.io") | not) | .name' -rj)
16+
fi
1317

1418
# Gathering cluster version all the crd related to operators.coreos.com and argoproj.io
1519
echo "gather_gitops:$LINENO] inspecting crd, clusterversion .." | tee -a ${LOGS_DIR}/gather_gitops.log

0 commit comments

Comments
 (0)