Consistently use ManagedObjectType
Some subsystems seem to have invented their own typedefs for this stuff,
move to using the one typedef in dbus::utility so we're consistent, and
we reduce our templates.
Tested: code compiles
This saves a negligible amount (104 bytes compressed) on our binary
size.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I952ea1f960aa703808d0ac80f35dc24cdd8d5027
diff --git a/redfish-core/lib/health.hpp b/redfish-core/lib/health.hpp
index 41352da..71da99e 100644
--- a/redfish-core/lib/health.hpp
+++ b/redfish-core/lib/health.hpp
@@ -85,41 +85,43 @@
}
if (!isChild)
{
- auto assocIt =
- interfaces.find("xyz.openbmc_project.Association");
- if (assocIt == interfaces.end())
+ for (const auto& [interface, association] : interfaces)
{
- continue;
- }
- auto endpointsIt = assocIt->second.find("endpoints");
- if (endpointsIt == assocIt->second.end())
- {
- BMCWEB_LOG_ERROR << "Illegal association at "
- << path.str;
- continue;
- }
- const std::vector<std::string>* endpoints =
- std::get_if<std::vector<std::string>>(
- &endpointsIt->second);
- if (endpoints == nullptr)
- {
- BMCWEB_LOG_ERROR << "Illegal association at "
- << path.str;
- continue;
- }
- bool containsChild = false;
- for (const std::string& endpoint : *endpoints)
- {
- if (std::find(inventory.begin(), inventory.end(),
- endpoint) != inventory.end())
+ if (interface != "xyz.openbmc_project.Association")
{
- containsChild = true;
- break;
+ continue;
}
- }
- if (!containsChild)
- {
- continue;
+ for (const auto& [name, value] : association)
+ {
+ if (name != "endpoints")
+ {
+ continue;
+ }
+
+ const std::vector<std::string>* endpoints =
+ std::get_if<std::vector<std::string>>(&value);
+ if (endpoints == nullptr)
+ {
+ BMCWEB_LOG_ERROR << "Illegal association at "
+ << path.str;
+ continue;
+ }
+ bool containsChild = false;
+ for (const std::string& endpoint : *endpoints)
+ {
+ if (std::find(inventory.begin(),
+ inventory.end(),
+ endpoint) != inventory.end())
+ {
+ containsChild = true;
+ break;
+ }
+ }
+ if (!containsChild)
+ {
+ continue;
+ }
+ }
}
}
}