File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ curl_with_retry() {
2222 local data_file=" $6 "
2323 local retry_count=0
2424
25+ local temp_file=" "
2526 # Create temp file if data is provided (either as string or file)
2627 if [[ -n " $data_file " ]]; then
2728 temp_file=" $data_file "
@@ -88,7 +89,7 @@ curl_with_retry() {
8889 rm -f " $temp_file "
8990 fi
9091
91- if [[ " $status_code " == " 200 " || " $status_code " == " 201 " ]]; then
92+ if [[ " $status_code " =~ ^2[0-9][0-9]$ ]]; then
9293 echo " $response_body "
9394 return 0
9495 else
380381
381382 if [[ $curl_exit_code -eq 0 && -n " $response " ]]; then
382383 # Extract target ID from response
383- target_id=$( echo " $response " | grep -o ' "id":"[^"]*" ' | cut -d ' " ' -f4 )
384+ target_id=$( echo " $response " | jq -r ' .id // empty ' )
384385 if [[ -n " $target_id " ]]; then
385386 echo " Target created successfully with ID: $target_id " >&2
386387 echo " $target_id "
486487
487488 if [[ $curl_exit_code -eq 0 && -n " $response " ]]; then
488489 # Extract dashboard ID from response
489- dashboard_id=$( echo " $response " | grep -o ' " dashboardId":"[^"]*" ' | cut -d ' " ' -f4 )
490+ dashboard_id=$( echo " $response " | jq -r ' . dashboardId // empty ' )
490491 if [[ -n " $dashboard_id " ]]; then
491492 echo " Dashboard created successfully with ID: $dashboard_id " >&2
492493 echo " $dashboard_id "
You can’t perform that action at this time.
0 commit comments