diff --git a/include/utility/json_utility.hpp b/include/utility/json_utility.hpp index cbdb1641..11324bbb 100644 --- a/include/utility/json_utility.hpp +++ b/include/utility/json_utility.hpp @@ -206,15 +206,6 @@ inline bool executePostFailAction(const nlohmann::json& i_parsedConfigJson, return false; } - if (!(i_parsedConfigJson["frus"][i_vpdFilePath].at(0).contains( - "PostFailAction"))) - { - logging::logMessage( - "PostFailAction flag missing in config JSON. Abort processing"); - - return false; - } - if (!(i_parsedConfigJson["frus"][i_vpdFilePath].at(0))["PostFailAction"] .contains(i_flagToProcess)) { @@ -455,13 +446,6 @@ inline bool procesSetGpioTag(const nlohmann::json& i_parsedConfigJson, l_errMsg += ex.what(); l_errMsg += " File: " + i_vpdFilePath + " Pel Logged"; - // Take failure postAction - if (!executePostFailAction(i_parsedConfigJson, i_vpdFilePath, - i_flagToProcess)) - { - logging::logMessage("executePostFailAction failed from exception."); - } - // ToDo -- Update Internal RC code EventLogger::createAsyncPelWithInventoryCallout( types::ErrorType::GpioError, types::SeverityType::Warning, diff --git a/src/worker.cpp b/src/worker.cpp index 9962b1b3..fcf29378 100644 --- a/src/worker.cpp +++ b/src/worker.cpp @@ -1159,50 +1159,27 @@ types::VPDMapVariant Worker::parseVpdFile(const std::string& i_vpdFilePath) "Empty VPD file path passed to Worker::parseVpdFile. Abort processing"); } - bool l_isPostFailActionRequired = false; - - // check if the FRU qualifies for pre action. - if (jsonUtility::isActionRequired(m_parsedJson, i_vpdFilePath, "preAction", - "collection")) + try { - // post fail action is required for a FRU if pre action is successful - // and some post fail action is defined for the FRU in the System Config - // JSON. - if (processPreAction(i_vpdFilePath, "collection") && - jsonUtility::isActionRequired(m_parsedJson, i_vpdFilePath, - "PostFailAction", "collection")) - { - l_isPostFailActionRequired = true; - } - else + if (jsonUtility::isActionRequired(m_parsedJson, i_vpdFilePath, + "preAction", "collection")) { - throw std::runtime_error("Pre-Action failed for path " + - i_vpdFilePath + - " Aborting collection for this FRU"); + if (!processPreAction(i_vpdFilePath, "collection")) + { + throw std::runtime_error("Pre-Action failed"); + } } - } - if (!std::filesystem::exists(i_vpdFilePath)) - { - if (l_isPostFailActionRequired) + if (!std::filesystem::exists(i_vpdFilePath)) { - if (!jsonUtility::executePostFailAction(m_parsedJson, i_vpdFilePath, - "collection")) - { - throw std::runtime_error("Post fail action failed for path " + - i_vpdFilePath + - " Aborting collection for this FRU"); - } + throw std::runtime_error("Could not find file path " + + i_vpdFilePath + + "Skipping parser trigger for the EEPROM"); } - throw std::runtime_error("Could not find file path " + i_vpdFilePath + - "Skipping parser trigger for the EEPROM"); - } + std::shared_ptr vpdParser = + std::make_shared(i_vpdFilePath, m_parsedJson); - std::shared_ptr vpdParser = std::make_shared(i_vpdFilePath, - m_parsedJson); - try - { types::VPDMapVariant l_parsedVpd = vpdParser->parse(); // Before returning, as collection is over, check if FRU qualifies for @@ -1224,8 +1201,9 @@ types::VPDMapVariant Worker::parseVpdFile(const std::string& i_vpdFilePath) } catch (std::exception& l_ex) { - // If VPD parsing fails, and post fail action is required, execute it. - if (l_isPostFailActionRequired) + // If post fail action is required, execute it. + if (jsonUtility::isActionRequired(m_parsedJson, i_vpdFilePath, + "PostFailAction", "collection")) { if (!jsonUtility::executePostFailAction(m_parsedJson, i_vpdFilePath, "collection"))