Skip to content

Commit eb5f106

Browse files
BZ1429398 removed the call to index from jq
QA is having issues using the script because it errors on the index function. Bug: 1429398
1 parent 801b564 commit eb5f106

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

images/router/clear-route-status.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ function clear_routers_status() {
4040
local route_name="${2}"
4141
local router_name="${3}"
4242
local my_json_blob; my_json_blob=$(oc get --raw http://localhost:8001/oapi/v1/namespaces/"${namespace}"/routes/"${route_name}"/)
43-
local index; index=$(echo "${my_json_blob}" | jq '.status.ingress | map(.routerName != "'${router_name}'") | index(false)')
44-
if [[ "${index}" != null ]]; then
45-
local modified_json; modified_json=$(echo "${my_json_blob}" | jq 'del(.status.ingress['${index}'])')
43+
local modified_json; modified_json=$(echo "${my_json_blob}" | jq '."status"."ingress"|=map(select(.routerName != "'${router_name}'"))')
44+
if [[ "${modified_json}" != "$(echo "${my_json_blob}" | jq '.')" ]]; then
4645
curl -s -X PUT http://localhost:8001/oapi/v1/namespaces/"${namespace}"/routes/"${route_name}"/status --data-binary "${modified_json}" -H "Content-Type: application/json" > /dev/null
4746
echo "route status for route "${route_name}" set by router "${router_name}" cleared"
4847
else

0 commit comments

Comments
 (0)