dreport: add led manager persistent data to BMC dump
Adding plugin to copy /var/lib/phosphor-led-manager/ directory
where LED manager persistent data is stored to BMC dump.
----------<Test case - failure in busctl command>-------
Thu Apr 14 08:16:53 UTC 2022 ERROR: Failed to collect led groups
Thu Apr 14 08:16:53 UTC 2022 INFO: Copied led groups
/var/lib/phosphor-led-manager/
root@xxx:/tmp/test/obmcdump_00000000_1649924210# du -sh
phosphor-led-manager/
4.0K phosphor-led-manager/
----------<Test case - busctl command success>----------
root@xxx:/tmp/test/obmcdump_00000000_1649927154# ls -lah ledgroups.log
-rw-r--r-- 1 root root 409.7K Apr 14 09:05 ledgroups.log
Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
Change-Id: I2939ae24762bf799f3fd1ccf6ebcc2c3c6d2c593
diff --git a/tools/dreport.d/plugins.d/ledgroup b/tools/dreport.d/plugins.d/ledgroup
new file mode 100644
index 0000000..de7faaf
--- /dev/null
+++ b/tools/dreport.d/plugins.d/ledgroup
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+#
+# config: 2 20
+# @brief: Collect LED groups details
+#
+
+# shellcheck disable=SC1091
+. "$DREPORT_INCLUDE"/functions
+
+desc="led groups"
+
+command="busctl call --verbose --no-pager \
+ xyz.openbmc_project.LED.GroupManager \
+ /xyz/openbmc_project/led/groups \
+ org.freedesktop.DBus.ObjectManager \
+ GetManagedObjects"
+
+file_name="ledgroups.log"
+
+if add_cmd_output "$command" "$file_name" "$desc";
+then
+ dir_name="/var/lib/phosphor-led-manager/"
+ if [ -d "$dir_name" ]; then
+ add_copy_file "$dir_name" "$desc"
+ fi
+fi