metron-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonzeo...@apache.org
Subject [metron-bro-plugin-kafka] branch master updated: METRON-1990 Bro plugin docker should exit nonzero if it encounters issues (JonZeolla) closes apache/metron-bro-plugin-kafka#28
Date Mon, 25 Feb 2019 13:15:13 GMT
This is an automated email from the ASF dual-hosted git repository.

jonzeolla pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/metron-bro-plugin-kafka.git


The following commit(s) were added to refs/heads/master by this push:
     new 2655f71  METRON-1990 Bro plugin docker should exit nonzero if it encounters issues
(JonZeolla) closes apache/metron-bro-plugin-kafka#28
2655f71 is described below

commit 2655f71694bde2e12e61fa9522a41a452161d845
Author: JonZeolla <zeolla@gmail.com>
AuthorDate: Mon Feb 25 08:14:38 2019 -0500

    METRON-1990 Bro plugin docker should exit nonzero if it encounters issues (JonZeolla)
closes apache/metron-bro-plugin-kafka#28
---
 docker/in_docker_scripts/process_data_file.sh          |  5 ++++-
 docker/run_end_to_end.sh                               |  3 +++
 docker/scripts/docker_run_bro_container.sh             | 10 +++++-----
 docker/scripts/docker_run_consume_bro_kafka.sh         |  3 +++
 docker/scripts/docker_run_create_bro_topic_in_kafka.sh |  3 +++
 docker/scripts/docker_run_get_offset_bro_kafka.sh      |  3 +++
 6 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/docker/in_docker_scripts/process_data_file.sh b/docker/in_docker_scripts/process_data_file.sh
index 021c5fd..81819a2 100755
--- a/docker/in_docker_scripts/process_data_file.sh
+++ b/docker/in_docker_scripts/process_data_file.sh
@@ -74,5 +74,8 @@ if [ ! -d /root/data ]; then
   exit 1
 fi
 cd /root/test_output/"${OUTPUT_DIRECTORY_NAME}" || exit 1
-find /root/data -type f -name "${PCAP_FILE_NAME}" -exec echo "processing" '{}' \; -exec bro
-r '{}' /usr/local/bro/share/bro/site/local.bro -C \;
+find /root/data -type f -name "${PCAP_FILE_NAME}" -print0 | xargs -0 bro -r {} /usr/local/bro/share/bro/site/local.bro
-C
+rc=$?; if [[ ${rc} != 0 ]]; then
+  exit ${rc}
+fi
 echo "done with ${PCAP_FILE_NAME}"
diff --git a/docker/run_end_to_end.sh b/docker/run_end_to_end.sh
index 950dc60..6baf679 100755
--- a/docker/run_end_to_end.sh
+++ b/docker/run_end_to_end.sh
@@ -131,6 +131,9 @@ fi
 # Download the pcaps
 bash "${SCRIPT_DIR}"/download_sample_pcaps.sh --data-path="${DATA_PATH}"
 
+# By not catching $? here we are accepting that a failed pcap download will not
+# exit the script
+
 mkdir "${TEST_OUTPUT_PATH}" || exit 1
 
 # Run the bro container and optionally the passed script _IN_ the container
diff --git a/docker/scripts/docker_run_bro_container.sh b/docker/scripts/docker_run_bro_container.sh
index 1e31b25..aba5d5f 100755
--- a/docker/scripts/docker_run_bro_container.sh
+++ b/docker/scripts/docker_run_bro_container.sh
@@ -137,13 +137,13 @@ echo "==================================================="
 declare -a DOCKER_CMD_BASE
 DOCKER_CMD="bash"
 DOCKER_CMD_BASE[0]="docker run -d -t --name ${CONTAINER_NAME} --network ${NETWORK_NAME} "
-DOCKER_CMD_BASE[2]="-v \"${OUR_SCRIPTS_PATH}:/root/built_in_scripts\" "
-DOCKER_CMD_BASE[3]="-v \"${BRO_PLUGIN_PATH}:/root/code\" "
-DOCKER_CMD_BASE[4]="-v \"${TEST_OUTPUT_PATH}:/root/test_output\" "
-OFFSET=5
+DOCKER_CMD_BASE[1]="-v \"${OUR_SCRIPTS_PATH}:/root/built_in_scripts\" "
+DOCKER_CMD_BASE[2]="-v \"${BRO_PLUGIN_PATH}:/root/code\" "
+DOCKER_CMD_BASE[3]="-v \"${TEST_OUTPUT_PATH}:/root/test_output\" "
+OFFSET=4
 if [[ -n "$SCRIPTS_PATH" ]]; then
   DOCKER_CMD_BASE[$OFFSET]="-v \"${SCRIPTS_PATH}:/root/scripts\" "
-  OFFSET=6
+  OFFSET=5
 fi
 
 if [[ -n "$DATA_PATH" ]]; then
diff --git a/docker/scripts/docker_run_consume_bro_kafka.sh b/docker/scripts/docker_run_consume_bro_kafka.sh
index eea740a..5a7bbcf 100755
--- a/docker/scripts/docker_run_consume_bro_kafka.sh
+++ b/docker/scripts/docker_run_consume_bro_kafka.sh
@@ -83,4 +83,7 @@ done
 
 docker run --rm --network "${NETWORK_NAME}" ches/kafka \
   kafka-console-consumer.sh --topic bro --offset "${OFFSET}" --partition 0 --bootstrap-server
kafka:9092 --timeout-ms 1000
+rc=$?; if [[ ${rc} != 0 ]]; then
+  exit ${rc}
+fi
 
diff --git a/docker/scripts/docker_run_create_bro_topic_in_kafka.sh b/docker/scripts/docker_run_create_bro_topic_in_kafka.sh
index cb00e2c..f4c84ab 100755
--- a/docker/scripts/docker_run_create_bro_topic_in_kafka.sh
+++ b/docker/scripts/docker_run_create_bro_topic_in_kafka.sh
@@ -71,4 +71,7 @@ echo "==================================================="
 
 docker run --rm --network "${NETWORK_NAME}" ches/kafka \
   kafka-topics.sh --create --topic bro --replication-factor 1 --partitions 1 --zookeeper
zookeeper:2181
+rc=$?; if [[ ${rc} != 0 ]]; then
+  exit ${rc}
+fi
 
diff --git a/docker/scripts/docker_run_get_offset_bro_kafka.sh b/docker/scripts/docker_run_get_offset_bro_kafka.sh
index d3b6621..eafd08f 100755
--- a/docker/scripts/docker_run_get_offset_bro_kafka.sh
+++ b/docker/scripts/docker_run_get_offset_bro_kafka.sh
@@ -72,4 +72,7 @@ done
 
 docker run --rm --network "${NETWORK_NAME}" ches/kafka \
   kafka-run-class.sh kafka.tools.GetOffsetShell --topic bro --broker-list kafka:9092
+rc=$?; if [[ ${rc} != 0 ]]; then
+  exit ${rc}
+fi
 


Mime
View raw message