VPD Tool: Fix for silencing unused variable warning
Signed-off-by: PriyangaRamasamy <priyanga24@in.ibm.com>
Change-Id: I05bdf989896a983b435ceefebc482d267a9c57f8
diff --git a/vpd_tool_impl.cpp b/vpd_tool_impl.cpp
index 1ee7b2b..26ff983 100644
--- a/vpd_tool_impl.cpp
+++ b/vpd_tool_impl.cpp
@@ -14,6 +14,15 @@
using namespace openpower::vpd;
namespace fs = std::filesystem;
+void VpdTool::printReturnCode(int returnCode)
+{
+ if (returnCode)
+ {
+ cout << "\n Command failed with the return code " << returnCode
+ << ". Continuing the execution. " << endl;
+ }
+}
+
void VpdTool::eraseInventoryPath(string& fru)
{
// Power supply frupath comes with INVENTORY_PATH appended in prefix.
@@ -407,16 +416,21 @@
}
}
+ cout.flush();
string udevRemove = "udevadm trigger -c remove -s \"*nvmem*\" -v";
- system(udevRemove.c_str());
+ int returnCode = system(udevRemove.c_str());
+ printReturnCode(returnCode);
string invManagerRestart =
"systemctl restart xyz.openbmc_project.Inventory.Manager.service";
- system(invManagerRestart.c_str());
+ returnCode = system(invManagerRestart.c_str());
+ printReturnCode(returnCode);
string sysVpdStop = "systemctl stop system-vpd.service";
- system(sysVpdStop.c_str());
+ returnCode = system(sysVpdStop.c_str());
+ printReturnCode(returnCode);
string udevAdd = "udevadm trigger -c add -s \"*nvmem*\" -v";
- system(udevAdd.c_str());
+ returnCode = system(udevAdd.c_str());
+ printReturnCode(returnCode);
}
diff --git a/vpd_tool_impl.hpp b/vpd_tool_impl.hpp
index 3062c3b..8757c31 100644
--- a/vpd_tool_impl.hpp
+++ b/vpd_tool_impl.hpp
@@ -117,6 +117,9 @@
*/
void eraseInventoryPath(std::string& fru);
+ /** @brief printReturnCode */
+ void printReturnCode(int returnCode);
+
public:
/**
* @brief Dump the complete inventory in JSON format