dreport: add inventory persistent data to BMC dump
1.Run busctl command to get the inventory data and add to
BMC dump.
2.Add /var/lib/phosphor-inventory-manager data to BMC dump.
Tested:
root@perfrain86bmc:/tmp/test/obmcdump_00000000_1649923539# du -sh
phosphor-inventory-manager/
12.4M phosphor-inventory-manager/
root@perfrain86bmc:/tmp/test/obmcdump_00000000_1649923539#
root@perfrain86bmc:/tmp/test/obmcdump_00000000_1649923539# ls -la inventory.log
-rw-r--r-- 1 root root 0 Apr 14 08:05 inventory.log
Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
Change-Id: Iccb50e5f3a068fe3e13326326bfc5e66471b8b9e
diff --git a/tools/dreport.d/plugins.d/inventory b/tools/dreport.d/plugins.d/inventory
index 0fbdf4b..75873b2 100644
--- a/tools/dreport.d/plugins.d/inventory
+++ b/tools/dreport.d/plugins.d/inventory
@@ -4,7 +4,8 @@
# @brief: Get the inventory information.
#
-. $DREPORT_INCLUDE/functions
+# shellcheck disable=SC1091
+. "$DREPORT_INCLUDE"/functions
desc="inventory"
@@ -16,4 +17,10 @@
file_name="inventory.log"
-add_cmd_output "$command" "$file_name" "$desc"
+if ! add_cmd_output "$command" "$file_name" "$desc";
+then
+ inventory_dir="/var/lib/phosphor-inventory-manager"
+ if [ -d "$inventory_dir" ]; then
+ add_copy_file "$inventory_dir" "$desc"
+ fi
+fi