Handle presence GPIO read failure
Take post failure action-
if presence GPIO pin couldn't be read
or it says FRU not attached to the slot
or corresponding expander GPIO pin couldn't be updated.
Signed-off-by: Alpana Kumari <alpankum@in.ibm.com>
Change-Id: Iff203d9a9eccc95c821e196b3d45e5f6bbd7ed6b
diff --git a/ibm_vpd_utils.cpp b/ibm_vpd_utils.cpp
index fbd2968..25960fc 100644
--- a/ibm_vpd_utils.cpp
+++ b/ibm_vpd_utils.cpp
@@ -719,6 +719,9 @@
if (!presenceLine)
{
+ cerr << "Couldn't find the presence line for - "
+ << presPinName << endl;
+
throw runtime_error(
"Couldn't find the presence line for the "
"GPIO. Skipping this GPIO action.");
@@ -746,9 +749,23 @@
}
logGpioPel(errMsg, i2cBusAddr);
+ // Take failure postAction
+ executePostFailAction(json, file);
return false;
}
}
+ else
+ {
+ // missing required informations
+ cerr << "VPD inventory JSON missing basic informations of presence "
+ "for this FRU : ["
+ << file << "]. Executing executePostFailAction." << endl;
+
+ // Take failure postAction
+ executePostFailAction(json, file);
+
+ return false;
+ }
}
return std::optional<bool>{};
}
@@ -782,6 +799,8 @@
if (!outputLine)
{
+ cerr << "Couldn't find the line for output pin - "
+ << pinName << endl;
throw runtime_error(
"Couldn't find output line for the GPIO. "
"Skipping this GPIO action.");
@@ -805,9 +824,26 @@
}
logGpioPel(errMsg, i2cBusAddr);
+
+ // Take failure postAction
+ executePostFailAction(json, file);
+
return false;
}
}
+ else
+ {
+ // missing required informations
+ cerr
+ << "VPD inventory JSON missing basic informations of preAction "
+ "for this FRU : ["
+ << file << "]. Executing executePostFailAction." << endl;
+
+ // Take failure postAction
+ executePostFailAction(json, file);
+
+ return false;
+ }
}
return true;
}