pldm_fru: Handle scenario when config JSON is missing
PLDM daemon will throw an InternalFailure exception if the PLDM FRU
JSON config directory is missing and will crash. This is relaxed and
the FRU commands will gracefully handle when FRU table does not exist.
Tested:
On Rainier the pldm daemon is started after removing the
/usr/share/pldm/fru directory and GetFRURecordTableMetadata and
GetFRURecordTable commands were executed using pldmtool.
1) GetFRURecordTableMetadata
pldmtool raw -d 0x80 0x04 0x01
Response Message:
08 01 00 04 01 00 01 00 ff ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00
2) GetFRURecordTable
pldmtool raw -d 0x80 0x04 0x02 0x00 0x00 0x00 0x00 0x00
Response Message:
08 01 00 04 02 00 00 00 00 00 05 00 00 00 00
Change-Id: I879a812abec8b1dc9c3ec7fa423ce3b3188d74b2
Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
diff --git a/libpldmresponder/fru.cpp b/libpldmresponder/fru.cpp
index 01afde3..23dd9fa 100644
--- a/libpldmresponder/fru.cpp
+++ b/libpldmresponder/fru.cpp
@@ -19,14 +19,14 @@
{
fru_parser::FruParser handle(configPath);
- auto dbusInfo = handle.inventoryLookup();
-
+ fru_parser::DBusLookupInfo dbusInfo;
// Read the all the inventory D-Bus objects
auto& bus = pldm::utils::DBusHandler::getBus();
dbus::ObjectValueTree objects;
try
{
+ dbusInfo = handle.inventoryLookup();
auto method = bus.new_method_call(
std::get<0>(dbusInfo).c_str(), std::get<1>(dbusInfo).c_str(),
"org.freedesktop.DBus.ObjectManager", "GetManagedObjects");