Health: Allow populate to only be called once
Populate does a mapper call and a get managed objects
and should only be called once. Enforce it.
Tested: No actual change, it is currently never called
twice, this is just for future protection with multiple
async calls.
Change-Id: I8fb9d8d19b2aa2a1c957a0ac8b609adf5e6ba6d0
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/redfish-core/lib/health.hpp b/redfish-core/lib/health.hpp
index 9127930..fe65ebf 100644
--- a/redfish-core/lib/health.hpp
+++ b/redfish-core/lib/health.hpp
@@ -148,6 +148,11 @@
// being added as children to the 'main' health object for the page
void populate()
{
+ if (populated)
+ {
+ return;
+ }
+ populated = true;
getAllStatusAssociations();
getGlobalPath();
}
@@ -210,5 +215,6 @@
bool isManagersHealth = false;
dbus::utility::ManagedObjectType statuses;
std::string globalInventoryPath = "-"; // default to illegal dbus path
+ bool populated = false;
};
} // namespace redfish
\ No newline at end of file