Traverse full GetSubTree output
It isn't safe to assume that the interface passed in to
GetSubtree will be the first one in the output, so need
to traverse the whole structure.
Tested: phosphor-discover-system-state was failing with the
C++ mapper, but works with this fix.
Change-Id: Ibc29280f9d51d8067e764da1745d30378bf7068d
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
diff --git a/settings.cpp b/settings.cpp
index e0600dc..70bf04e 100644
--- a/settings.cpp
+++ b/settings.cpp
@@ -43,15 +43,20 @@
for (const auto& iter : result)
{
const Path& path = iter.first;
- const Interface& interface = iter.second.begin()->second[0];
- if (autoRebootIntf == interface)
+ for (const auto& serviceIter : iter.second)
{
- autoReboot = path;
- }
- else if (powerRestoreIntf == interface)
- {
- powerRestorePolicy = path;
+ for (const auto& interface : serviceIter.second)
+ {
+ if (autoRebootIntf == interface)
+ {
+ autoReboot = path;
+ }
+ else if (powerRestoreIntf == interface)
+ {
+ powerRestorePolicy = path;
+ }
+ }
}
}
}