VPD Manager: Allow Full Inventory Paths
This commit allows us to use full inventory paths
in the VPD manager D-Bus APIs.
The manager implementation expected a path without the
`/xyz/openbmc_project/inventory/` prefix. This commit
allows for both a truncated path as well as a full path.
Signed-off-by: Santosh Puranik <santosh.puranik@in.ibm.com>
Change-Id: I12c9e2eaaceba760bfcac6f5bc8d896b81eb41b0
diff --git a/vpd-manager/manager.cpp b/vpd-manager/manager.cpp
index edef56b..d05dd69 100644
--- a/vpd-manager/manager.cpp
+++ b/vpd-manager/manager.cpp
@@ -113,19 +113,26 @@
{
try
{
- if (frus.find(path) == frus.end())
+ std::string objPath{path};
+ // Strip any inventory prefix in path
+ if (objPath.find(INVENTORY_PATH) == 0)
+ {
+ objPath = objPath.substr(sizeof(INVENTORY_PATH) - 1);
+ }
+
+ if (frus.find(objPath) == frus.end())
{
throw std::runtime_error("Inventory path not found");
}
- inventory::Path vpdFilePath = frus.find(path)->second.first;
+ inventory::Path vpdFilePath = frus.find(objPath)->second.first;
// instantiate editor class to update the data
- EditorImpl edit(vpdFilePath, jsonFile, recordName, keyword, path);
+ EditorImpl edit(vpdFilePath, jsonFile, recordName, keyword, objPath);
edit.updateKeyword(value, true);
// if it is a motehrboard FRU need to check for location expansion
- if (frus.find(path)->second.second)
+ if (frus.find(objPath)->second.second)
{
if (recordName == "VCEN" && (keyword == "FC" || keyword == "SE"))
{