Skip to content

Commit

Permalink
chore: remove extra string from 409 status (#491)
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
mmta authored Feb 16, 2024
1 parent 83f7a24 commit 8e4eb31
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
3 changes: 1 addition & 2 deletions demo/scripts/idxpattern-import.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ for f in $(ls $dname/idxpattern-*); do
echo -n "Installing index pattern $f .. "
idxpattern=$(cat $f)
res=$(curl -fsS -o /dev/null -X POST "http://${host}:5601/api/saved_objects/index-pattern/$name-*" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d "$idxpattern" 2>&1)
( echo $res | grep -q "409 Conflict" && echo done ) || echo "failed to install: $res"
(echo $res | grep -q "409" && echo done) || echo "failed to install: $res"

done

16 changes: 8 additions & 8 deletions demo/scripts/kbndashboard-import.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@

host=$1
dashboard=$(cat $2)
command -v curl >/dev/null 2>&1 || { echo the required curl command is not available && exit 1 ;}
command -v curl >/dev/null 2>&1 || { echo the required curl command is not available && exit 1; }

while ! curl -fsS ${host}:5601 -o /dev/null; do
echo cannot connect to ${host}:5601, will retry in 5 sec ..
sleep 5
done

echo -n installing kibana dashboard to ${host}:5601 .. && \
curl -fsS -o /dev/null -X POST "http://${host}:5601/api/kibana/dashboards/import?force=true" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d "$dashboard" && \
echo done. && \
echo -n setting default index to siem_alarms .. && \
curl -fsS -o /dev/null -XPOST -H "Content-Type: application/json" -H "kbn-xsrf: true" ${host}:5601/api/kibana/settings/defaultIndex -d '{"value": "siem_alarms"}' && \
echo done
echo -n installing kibana dashboard to ${host}:5601 .. &&
curl -fsS -o /dev/null -X POST "http://${host}:5601/api/kibana/dashboards/import?force=true" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d "$dashboard" &&
echo done. &&
echo -n setting default index to siem_alarms .. &&
curl -fsS -o /dev/null -XPOST -H "Content-Type: application/json" -H "kbn-xsrf: true" ${host}:5601/api/kibana/settings/defaultIndex -d '{"value": "siem_alarms"}' &&
echo done

# now for the extra siem_alarm_events idx pattern

Expand All @@ -26,4 +26,4 @@ patternfile="$(dirname $2)/idxpattern-siem_alarm_events.json"
echo -n "Installing index pattern siem-alarm_events from $patternfile .. "
idxpattern=$(cat $patternfile)
res=$(curl -fsS -o /dev/null -X POST "http://${host}:5601/api/saved_objects/index-pattern/siem_alarm_events" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d "$idxpattern" 2>&1)
(echo $res | grep -q "409 Conflict" && echo done) || echo "failed to install: $res"
(echo $res | grep -q "409" && echo done) || echo "failed to install: $res"

0 comments on commit 8e4eb31

Please sign in to comment.