Skip to content

Commit

Permalink
Merge pull request ibm-openbmc#595 from branupama/dump_inventory
Browse files Browse the repository at this point in the history
vpd-tool: Fix dump object path
  • Loading branch information
SunnySrivastava1984 authored Jan 17, 2025
2 parents 2a1c39b + 5271a27 commit 8d35fae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion vpd-tool/include/vpd_tool.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ class VpdTool
*
* @return On success returns 0, otherwise returns -1.
*/
int dumpObject(const std::string& i_fruPath) const noexcept;
int dumpObject(std::string i_fruPath) const noexcept;

/**
* @brief API to fix system VPD keywords.
Expand Down
13 changes: 8 additions & 5 deletions vpd-tool/src/vpd_tool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,14 @@ int VpdTool::readKeyword(const std::string& i_vpdPath,
return l_rc;
}

int VpdTool::dumpObject(const std::string& i_fruPath) const noexcept
int VpdTool::dumpObject(std::string i_fruPath) const noexcept
{
int l_rc{constants::FAILURE};
try
{
// ToDo: For PFuture system take only full path from the user.
i_fruPath = constants::baseInventoryPath + i_fruPath;

nlohmann::json l_resultJsonArray = nlohmann::json::array({});
const nlohmann::json l_fruJson = getFruProperties(i_fruPath);
if (!l_fruJson.empty())
Expand All @@ -104,16 +107,16 @@ int VpdTool::dumpObject(const std::string& i_fruPath) const noexcept
}
else
{
std::cout << "FRU " << i_fruPath << " is not present in the system"
<< std::endl;
std::cout << "FRU [" << i_fruPath
<< "] is not present in the system" << std::endl;
}
l_rc = constants::SUCCESS;
}
catch (std::exception& l_ex)
{
// TODO: Enable logging when verbose is enabled.
// std::cerr << "Dump Object failed for FRU: " << i_fruPath
// << " Error: " << l_ex.what() << std::endl;
// std::cerr << "Dump Object failed for FRU [" << i_fruPath
// << "], Error: " << l_ex.what() << std::endl;
}
return l_rc;
}
Expand Down

0 comments on commit 8d35fae

Please sign in to comment.