From 9a1c049856d139071bded93fc5a67d7d74816e8b Mon Sep 17 00:00:00 2001
From: Matthew McGill <mhollismcgill@gmail.com>
Date: Mon, 22 Oct 2018 16:21:25 +0000
Subject: [PATCH] thanos integration

Former-commit-id: fdd813fcf1462d6f226e15888523f83476b59812
---
 tools/ps_analyze.sh | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/tools/ps_analyze.sh b/tools/ps_analyze.sh
index f3ec92ab8..8dad41b36 100755
--- a/tools/ps_analyze.sh
+++ b/tools/ps_analyze.sh
@@ -557,7 +557,7 @@ perform_step()
 
                 if [ "$thanos_res" = "ERR_INVALID_CMD"  ]; then
                         echo Internal Transform_Step plugin architecture error.
-                        echo Exiting ps_analyze early.
+                        echo Unrecognized EXECUTE_STEP command. Exiting ps_analyze early.
                         exit -1
                 elif [ "$thanos_res" = "STEP_UNSUPPORTED" ]; then
                         command_exit=127 # command not found
@@ -1023,6 +1023,23 @@ output_pipe="thanos_output"
 $SECURITY_TRANSFORMS_HOME/plugins_install/thanos.exe $input_pipe $output_pipe &
 thanos_pid=$!
 
+# set thanos execution mode
+if [ ! -z "$DEBUG_STEPS" ]; then
+        printf "SET_MODE DEBUG" > $input_pipe
+elif [ ! -z "$VERBOSE" ]; then
+	printf "SET_MODE VERBOSE" > $input_pipe
+else
+	printf "SET_MODE DEFAULT" > $input_pipe
+fi
+
+read -r mode_set_res < $output_pipe
+
+if [ "$mode_set_res" != "MODE_SET_OK" ]; then
+	echo Internal Transform_Step plugin architecture error.
+	echo Mode set failed. Exiting ps_analyze early.
+	exit -1
+fi
+
 # Make sure thanos is always exited
 function exit_thanos {
 	# will do the job for emergency exits
-- 
GitLab