phosphor-debug-collector: Phosphor Pass errors to watch through YAML file

Refactored code to pass error objects to watch through YAML file
Dump will be created when an error object created matches
the error object path specified in the YAML file.

(From meta-phosphor rev: ae622549f4947084e549ec5cfc40f88daa5c4ae6)

Change-Id: I9eb1c53ee4e1580d903e1004009d7595fb7811a6
Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/meta-phosphor/recipes-phosphor/dump/phosphor-debug-collector_git.bb b/meta-phosphor/recipes-phosphor/dump/phosphor-debug-collector_git.bb
index 3ac005b..3fd6f0b 100644
--- a/meta-phosphor/recipes-phosphor/dump/phosphor-debug-collector_git.bb
+++ b/meta-phosphor/recipes-phosphor/dump/phosphor-debug-collector_git.bb
@@ -35,6 +35,7 @@
         sdbusplus \
         sdbusplus-native \
         autoconf-archive-native \
+        virtual/phosphor-debug-errors \
 "
 
 RDEPENDS_${PN}-manager += " \
@@ -62,7 +63,11 @@
 
 SYSTEMD_SUBSTITUTIONS += "BMC_DUMP_PATH:${bmc_dump_path}:${MGR_SVC}"
 
-FILES_${PN}-manager += "${sbindir}/phosphor-dump-manager ${exec_prefix}/lib/tmpfiles.d/coretemp.conf"
+FILES_${PN}-manager +=  " \
+    ${sbindir}/phosphor-dump-manager \
+    ${exec_prefix}/lib/tmpfiles.d/coretemp.conf \
+    ${datadir}/dump/ \
+    "
 FILES_${PN}-monitor += "${sbindir}/phosphor-dump-monitor"
 FILES_${PN}-dreport += "${bindir}/dreport"
 FILES_${PN}-scripts += "${dreport_dir}"
@@ -70,7 +75,10 @@
 DBUS_SERVICE_${PN}-manager += "${MGR_SVC}"
 SYSTEMD_SERVICE_${PN}-monitor += "obmc-dump-monitor.service"
 
-EXTRA_OECONF = "BMC_DUMP_PATH=${bmc_dump_path}"
+EXTRA_OECONF = " \
+    BMC_DUMP_PATH=${bmc_dump_path} \
+    ERROR_MAP_YAML=${STAGING_DIR_NATIVE}/${datadir}/dump/errors_watch.yaml \
+    "
 
 S = "${WORKDIR}/git"
 SRC_URI += "file://coretemp.conf"
diff --git a/meta-phosphor/recipes-phosphor/dump/phosphor-debug-errors-native.bb b/meta-phosphor/recipes-phosphor/dump/phosphor-debug-errors-native.bb
new file mode 100644
index 0000000..7a6870c
--- /dev/null
+++ b/meta-phosphor/recipes-phosphor/dump/phosphor-debug-errors-native.bb
@@ -0,0 +1,19 @@
+SUMMARY = "Debug collector error watch config file"
+PR = "r1"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${PHOSPHORBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658"
+
+inherit native
+
+SRC_URI += "file://errors_watch.yaml"
+
+PROVIDES += "virtual/phosphor-debug-errors"
+
+S = "${WORKDIR}"
+
+do_install_append() {
+    DEST=${D}${datadir}/dump
+    install -d ${DEST}
+    install errors_watch.yaml ${DEST}/
+}
+
diff --git a/meta-phosphor/recipes-phosphor/dump/phosphor-debug-errors/errors_watch.yaml b/meta-phosphor/recipes-phosphor/dump/phosphor-debug-errors/errors_watch.yaml
new file mode 100644
index 0000000..cb38153
--- /dev/null
+++ b/meta-phosphor/recipes-phosphor/dump/phosphor-debug-errors/errors_watch.yaml
@@ -0,0 +1,2 @@
+elog:
+    - xyz.openbmc_project.Common.Error.InternalFailure