AddObject bugfix
We need to add the new item to the config before we write it,
and the new item is under the Exposes path of the parent.
Tested: Used redfish to patch new pid, config file was right
on first patch.
Change-Id: I2b8abfd97a95a7d9f9ea93cf41d9a403a299fc2d
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/src/EntityManager.cpp b/src/EntityManager.cpp
index 57c9fda..bd8ccc7 100644
--- a/src/EntityManager.cpp
+++ b/src/EntityManager.cpp
@@ -911,6 +911,7 @@
throw std::invalid_argument("Data does not match schema");
}
+ findExposes->push_back(newData);
if (!writeJsonFiles(systemConfiguration))
{
std::cerr << "Error writing json files\n";
@@ -927,11 +928,9 @@
// runtime modifiable
populateInterfaceFromJson(
systemConfiguration,
- jsonPointerPath + "/" + std::to_string(lastIndex), iface,
- newData, objServer,
+ jsonPointerPath + "/Exposes/" + std::to_string(lastIndex),
+ iface, newData, objServer,
sdbusplus::asio::PropertyPermission::readWrite);
- // todo(james) generate patch
- findExposes->push_back(newData);
});
iface->initialize();
}