Skip to content

Commit 5271a27

Browse files
committed
vpd-tool: Fix dump object path
This commit adds the base inventory path which is, ‘/xyz/openbmc_project/inventory’ to the user given object path. As the user of the vpd-tool gives object path, which starts after this base path. Output: ‘’’ Command without base path: root@p10bmc:/tmp# ./vpd-tool -o -O /system/chassis [ { "/xyz/openbmc_project/inventory/system/chassis": { "CC": "2E33", "DR": "SYSTEM BACKPLANE", "FN": "F040221", "LocationCode": "U780C.ND0.1234567", "PN": "PN12345", "PrettyName": "Chassis", "SN": "YL2E33010000", "type": "xyz.openbmc_project.Inventory.Item.Chassis" } } ] Command with base path: root@p10bmc:/tmp# ./vpd-tool -o -O /xyz/openbmc_project/inventory/system/chassis FRU [/xyz/openbmc_project/inventory/xyz/openbmc_project/inventory/system/chassis] is not present in the system ‘’’ Signed-off-by: Anupama B R <[email protected]>
1 parent 6a8e56f commit 5271a27

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

vpd-tool/include/vpd_tool.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ class VpdTool
205205
*
206206
* @return On success returns 0, otherwise returns -1.
207207
*/
208-
int dumpObject(const std::string& i_fruPath) const noexcept;
208+
int dumpObject(std::string i_fruPath) const noexcept;
209209

210210
/**
211211
* @brief API to fix system VPD keywords.

vpd-tool/src/vpd_tool.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,14 @@ int VpdTool::readKeyword(const std::string& i_vpdPath,
8989
return l_rc;
9090
}
9191

92-
int VpdTool::dumpObject(const std::string& i_fruPath) const noexcept
92+
int VpdTool::dumpObject(std::string i_fruPath) const noexcept
9393
{
9494
int l_rc{constants::FAILURE};
9595
try
9696
{
97+
// ToDo: For PFuture system take only full path from the user.
98+
i_fruPath = constants::baseInventoryPath + i_fruPath;
99+
97100
nlohmann::json l_resultJsonArray = nlohmann::json::array({});
98101
const nlohmann::json l_fruJson = getFruProperties(i_fruPath);
99102
if (!l_fruJson.empty())
@@ -104,16 +107,16 @@ int VpdTool::dumpObject(const std::string& i_fruPath) const noexcept
104107
}
105108
else
106109
{
107-
std::cout << "FRU " << i_fruPath << " is not present in the system"
108-
<< std::endl;
110+
std::cout << "FRU [" << i_fruPath
111+
<< "] is not present in the system" << std::endl;
109112
}
110113
l_rc = constants::SUCCESS;
111114
}
112115
catch (std::exception& l_ex)
113116
{
114117
// TODO: Enable logging when verbose is enabled.
115-
// std::cerr << "Dump Object failed for FRU: " << i_fruPath
116-
// << " Error: " << l_ex.what() << std::endl;
118+
// std::cerr << "Dump Object failed for FRU [" << i_fruPath
119+
// << "], Error: " << l_ex.what() << std::endl;
117120
}
118121
return l_rc;
119122
}

0 commit comments

Comments
 (0)