pid: Don't delete configurations
Code added that deleted configurations was needed to
get the chassis data. Instead just count the number
of configurations to not allow posting more.
Tested: Creating new PIDs worked again
Change-Id: Ieb7ff7d16967402da64faf6a5cb2d0989af36d23
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index b6d554f..1d9c5a8 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -1244,25 +1244,18 @@
pidConfigurationIface, pidZoneConfigurationIface,
stepwiseConfigurationIface};
- // erase the paths we don't care about
- for (auto it = mObj.begin(); it != mObj.end();)
+ for (const auto& [path, object] : mObj)
{
- bool found = false;
- for (const auto& [interface, _] : it->second)
+ for (const auto& [interface, _] : object)
{
if (std::find(configurations.begin(),
configurations.end(),
interface) != configurations.end())
{
- found = true;
- it++;
+ self->objectCount++;
break;
}
}
- if (!found)
- {
- it = mObj.erase(it);
- }
}
self->managedObj = std::move(mObj);
},
@@ -1473,7 +1466,7 @@
// arbitrary limit to avoid attacks
constexpr const size_t controllerLimit = 500;
- if (createNewObject && managedObj.size() >= controllerLimit)
+ if (createNewObject && objectCount >= controllerLimit)
{
messages::resourceExhaustion(response->res, type);
continue;
@@ -1570,6 +1563,7 @@
std::string currentProfile;
std::string profileConnection;
std::string profilePath;
+ size_t objectCount = 0;
};
class Manager : public Node