Rename vars in postToDbus
The boardName var was actually a D-Bus path, so rename it to boardPath.
The actual name of the board was stored in the boardKey variable, so now
that can be renamed to boardName.
Tested:
Entity Manager still creates the same objects.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I282357bc84835925bbf3f09720787a7b7d4c3131
diff --git a/src/entity_manager.cpp b/src/entity_manager.cpp
index ee08c00..d56a9f4 100644
--- a/src/entity_manager.cpp
+++ b/src/entity_manager.cpp
@@ -571,8 +571,8 @@
// iterate through boards
for (const auto& [boardId, boardConfig] : newConfiguration.items())
{
- std::string boardKey = boardConfig["Name"];
- std::string boardKeyOrig = boardConfig["Name"];
+ std::string boardName = boardConfig["Name"];
+ std::string boardNameOrig = boardConfig["Name"];
std::string jsonPointerPath = "/" + boardId;
// loop through newConfiguration, but use values from system
// configuration to be able to modify via dbus later
@@ -588,30 +588,30 @@
}
else
{
- std::cerr << "Unable to find type for " << boardKey
+ std::cerr << "Unable to find type for " << boardName
<< " reverting to Chassis.\n";
boardType = "Chassis";
}
std::string boardtypeLower = boost::algorithm::to_lower_copy(boardType);
- std::regex_replace(boardKey.begin(), boardKey.begin(), boardKey.end(),
- illegalDbusMemberRegex, "_");
- std::string boardName = "/xyz/openbmc_project/inventory/system/";
- boardName += boardtypeLower;
- boardName += "/";
- boardName += boardKey;
+ std::regex_replace(boardName.begin(), boardName.begin(),
+ boardName.end(), illegalDbusMemberRegex, "_");
+ std::string boardPath = "/xyz/openbmc_project/inventory/system/";
+ boardPath += boardtypeLower;
+ boardPath += "/";
+ boardPath += boardName;
std::shared_ptr<sdbusplus::asio::dbus_interface> inventoryIface =
- createInterface(objServer, boardName,
- "xyz.openbmc_project.Inventory.Item", boardKey);
+ createInterface(objServer, boardPath,
+ "xyz.openbmc_project.Inventory.Item", boardName);
std::shared_ptr<sdbusplus::asio::dbus_interface> boardIface =
- createInterface(objServer, boardName,
+ createInterface(objServer, boardPath,
"xyz.openbmc_project.Inventory.Item." + boardType,
- boardKeyOrig);
+ boardNameOrig);
- createAddObjectMethod(jsonPointerPath, boardName, systemConfiguration,
- objServer, boardKeyOrig);
+ createAddObjectMethod(jsonPointerPath, boardPath, systemConfiguration,
+ objServer, boardNameOrig);
populateInterfaceFromJson(systemConfiguration, jsonPointerPath,
boardIface, boardValues, objServer);
@@ -622,8 +622,8 @@
if (propValue.type() == nlohmann::json::value_t::object)
{
std::shared_ptr<sdbusplus::asio::dbus_interface> iface =
- createInterface(objServer, boardName, propName,
- boardKeyOrig);
+ createInterface(objServer, boardPath, propName,
+ boardNameOrig);
populateInterfaceFromJson(systemConfiguration,
jsonPointerPath + propName, iface,
@@ -678,21 +678,21 @@
std::string itemName = findName->get<std::string>();
std::regex_replace(itemName.begin(), itemName.begin(),
itemName.end(), illegalDbusMemberRegex, "_");
- std::string ifacePath = boardName;
+ std::string ifacePath = boardPath;
ifacePath += "/";
ifacePath += itemName;
std::shared_ptr<sdbusplus::asio::dbus_interface> itemIface =
createInterface(objServer, ifacePath,
"xyz.openbmc_project.Configuration." + itemType,
- boardKeyOrig);
+ boardNameOrig);
if (itemType == "BMC")
{
std::shared_ptr<sdbusplus::asio::dbus_interface> bmcIface =
createInterface(objServer, ifacePath,
"xyz.openbmc_project.Inventory.Item.Bmc",
- boardKeyOrig);
+ boardNameOrig);
populateInterfaceFromJson(systemConfiguration, jsonPointerPath,
bmcIface, item, objServer,
getPermission(itemType));
@@ -702,7 +702,7 @@
std::shared_ptr<sdbusplus::asio::dbus_interface> systemIface =
createInterface(objServer, ifacePath,
"xyz.openbmc_project.Inventory.Item.System",
- boardKeyOrig);
+ boardNameOrig);
populateInterfaceFromJson(systemConfiguration, jsonPointerPath,
systemIface, item, objServer,
getPermission(itemType));
@@ -726,7 +726,7 @@
std::shared_ptr<sdbusplus::asio::dbus_interface>
objectIface = createInterface(objServer, ifacePath,
- ifaceName, boardKeyOrig);
+ ifaceName, boardNameOrig);
populateInterfaceFromJson(
systemConfiguration, jsonPointerPath, objectIface,
@@ -770,7 +770,7 @@
std::shared_ptr<sdbusplus::asio::dbus_interface>
objectIface = createInterface(
- objServer, ifacePath, ifaceName, boardKeyOrig);
+ objServer, ifacePath, ifaceName, boardNameOrig);
populateInterfaceFromJson(
systemConfiguration,
@@ -782,7 +782,7 @@
}
}
- topology.addBoard(boardName, boardType, item);
+ topology.addBoard(boardPath, boardType, item);
}
}