Set error code for isFruReplaceableAtRuntime API
This commit updates isFruReplaceableAtRuntime API to set error code in
case of error. This helps caller of API to take action based on the
error code returned from the API.
Change-Id: Ibf07dcbce8aaf25a21e851a562914807cec35228
Signed-off-by: Rekha Aparna <vrekhaaparna@ibm.com>
diff --git a/vpd-manager/src/worker.cpp b/vpd-manager/src/worker.cpp
index 2521606..de14c38 100644
--- a/vpd-manager/src/worker.cpp
+++ b/vpd-manager/src/worker.cpp
@@ -1923,8 +1923,21 @@
// Check if host is up and running
if (dbusUtility::isHostRunning())
{
- if (!jsonUtility::isFruReplaceableAtRuntime(m_parsedJson,
- l_fruPath))
+ uint16_t l_errCode = 0;
+ bool isFruReplaceableAtRuntime =
+ jsonUtility::isFruReplaceableAtRuntime(m_parsedJson, l_fruPath,
+ l_errCode);
+
+ if (l_errCode)
+ {
+ logging::logMessage(
+ "Failed to check if FRU is replaceable at runtime for FRU : [" +
+ std::string(i_dbusObjPath) + "], error : " +
+ vpdSpecificUtility::getErrCodeMsg(l_errCode));
+ return;
+ }
+
+ if (!isFruReplaceableAtRuntime)
{
logging::logMessage(
"Given FRU is not replaceable at host runtime. Single FRU VPD collection is not performed for " +
@@ -1947,9 +1960,21 @@
vpdSpecificUtility::getErrCodeMsg(l_errCode));
}
- if (!isFruReplaceableAtStandby &&
- (!jsonUtility::isFruReplaceableAtRuntime(m_parsedJson,
- l_fruPath)))
+ l_errCode = 0;
+ bool isFruReplaceableAtRuntime =
+ jsonUtility::isFruReplaceableAtRuntime(m_parsedJson, l_fruPath,
+ l_errCode);
+
+ if (l_errCode)
+ {
+ logging::logMessage(
+ "Failed to check if FRU is replaceable at runtime for FRU : [" +
+ std::string(i_dbusObjPath) + "], error : " +
+ vpdSpecificUtility::getErrCodeMsg(l_errCode));
+ return;
+ }
+
+ if (!isFruReplaceableAtStandby && (!isFruReplaceableAtRuntime))
{
logging::logMessage(
"Given FRU is neither replaceable at standby nor replaceable at runtime. Single FRU VPD collection is not performed for " +