8a76cdd9292846b277277355a710460746293e15
[oom.git] / kubernetes / pomba / charts / pomba-contextaggregator / resources / bin / pre_start.sh
1 #!/bin/sh
2
3 # Get the list of topic from curl ressult
4 dmaap_mr_host=message-router
5 dmaap_mr_port=3904
6 temp_output_file=".tmpoutput"
7 curl -X GET http://$dmaap_mr_host:$dmaap_mr_port/topics  > $temp_output_file
8
9 # Test topic POA-AUDIT-INIT, POA-AUDIT-RESULT, POA-RULE-VALIDATION
10 TOPICS="POA-AUDIT-INIT POA-RULE-VALIDATION POA-AUDIT-RESULT"
11 for i_topic in $TOPICS
12 do
13   echo "Looping ... topic: $i_topic"
14   if grep -iFq "$i_topic" $temp_output_file
15   then
16       # code if found
17       echo "$i_topic found."
18   else
19       # code if not found
20       echo "$i_topic NOT found."
21       curl -X POST -H "content-type: application/json" --data '{"event":"create topic"}' http://$dmaap_mr_host:$dmaap_mr_port/events/$i_topic
22   fi
23 done
24
25 # remove the temp file
26 rm -f $temp_output_file