Refactor to pass errors to watch through config YAML

Add errors to watch for through error YAML file
Add support for checkstop error type

Tested:
Generating dumps for elog, core, checkstop type errors.

Change-Id: Idd00ace2e3d0c472a74ec142e6d150e55e843a6f
Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
diff --git a/tools/dreport.d/dreport b/tools/dreport.d/dreport
index 7fc1c32..3b6dce3 100755
--- a/tools/dreport.d/dreport
+++ b/tools/dreport.d/dreport
@@ -43,6 +43,7 @@
 declare -rx TYPE_USER="user"
 declare -rx TYPE_CORE="core"
 declare -rx TYPE_ELOG="elog"
+declare -rx TYPE_CHECKSTOP="checkstop"
 declare -rx SUMMARY_LOG="summary.log"
 declare -rx DREPORT_LOG="dreport.log"
 declare -rx TMP_DIR="/tmp"
@@ -94,6 +95,11 @@
             elog_id=$(basename "$optional_path")
             set_elog_pid
             ;;
+        $TYPE_CHECKSTOP)
+            log_summary "CHECKSTOP: $optional_path"
+            elog_id=$(basename "$optional_path")
+            set_elog_pid
+            ;;
 
         $SUMMARY_DUMP)
             #No data collection is required.
@@ -190,7 +196,8 @@
     #Type
     if [[ !($dump_type = $TYPE_USER || \
             $dump_type = $TYPE_CORE || \
-            $dump_type = $TYPE_ELOG) ]]; then
+            $dump_type = $TYPE_ELOG || \
+            $dump_type = $TYPE_CHECKSTOP) ]]; then
        log_error "Invalid -type, Only summary log is available"
        dump_type=$SUMMARY_DUMP
     fi
diff --git a/tools/dreport.d/sample.conf b/tools/dreport.d/sample.conf
index 8a0e24a..45f5e59 100644
--- a/tools/dreport.d/sample.conf
+++ b/tools/dreport.d/sample.conf
@@ -8,3 +8,4 @@
 1: core
 2: user
 3: elog
+4: checkstop