dump_to_dict not working for empty dump subdirs
Example:
In /var/lib/phosphor-debug-collector/dumps, there are the following
subdirectories. However, 11 is empty.
11 12 13 14 15 16
Change-Id: Ifca568de68ad62e5492b79aae2f01edd7ee431da
Signed-off-by: Michael Walsh <micwalsh@us.ibm.com>
diff --git a/lib/dump_utils.py b/lib/dump_utils.py
index 536b73e..0c4a880 100755
--- a/lib/dump_utils.py
+++ b/lib/dump_utils.py
@@ -49,8 +49,9 @@
quiet = int(gp.get_var_value(quiet, 1))
cmd_buf = "dump_dir_path=" + var.DUMP_DIR_PATH + " ; " \
- + "for dump_id in $(ls ${dump_dir_path} | sort -n) ; " \
- + "do echo -n $dump_id: ; ls ${dump_dir_path}${dump_id}/* ; done"
+ + "for dump_id in $(ls ${dump_dir_path} | sort -n) ; do " \
+ + "file_path=$(ls ${dump_dir_path}${dump_id}/* 2>/dev/null)" \
+ + " || continue ; echo ${dump_id}:${file_path} ; done"
output, stderr, rc = bsu.bmc_execute_command(cmd_buf, quiet=quiet)
return vf.key_value_outbuf_to_dict(output)