Add a helper function getFruData to updateFRUProperty
Refactoring updateFRUProperty function and created a new helper
function getFruData. Moved this function to fru_utils.cpp as it
is common for all fru-device deamons and avoid code duplication.
This patch is created based on suggestion on the below patch.
https://gerrit.openbmc.org/c/openbmc/entity-manager/+/51555
TESTED : Built Facebook YosemiteV2 images and loaded
on the target hardware. Verified all the fru's read and write.
Signed-off-by: Kumar Thangavel <thangavel.k@hcl.com>
Change-Id: I7514469d5798c68efce7353ca486195016cacf81
diff --git a/src/fru_device.cpp b/src/fru_device.cpp
index 26ac516..1263c02 100644
--- a/src/fru_device.cpp
+++ b/src/fru_device.cpp
@@ -1033,19 +1033,10 @@
}
std::vector<uint8_t> fruData;
- try
- {
- fruData = getFRUInfo(static_cast<uint16_t>(bus),
- static_cast<uint8_t>(address));
- }
- catch (const std::invalid_argument& e)
- {
- std::cerr << "Failure getting FRU Info" << e.what() << "\n";
- return false;
- }
- if (fruData.empty())
+ if (!getFruData(fruData, bus, address))
{
+ std::cerr << "Failure getting FRU Data \n";
return false;
}