control: Pair profiles with name as key
Include the profiles of a configuration object in combination with its
name to construct a unique key for building the complete fan control
configuration. This is necessary for supporting the zones, groups, and
events configurations.
Tested:
Object name and list of profiles construct key
Profile objects always contain an empty list of profiles
Fan objects may or may not contain a list of profiles
Change-Id: I4be7229e3fb695d845d60159d0f08f601512c812
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/json/fan.cpp b/control/json/fan.cpp
index 4512f49..3fe4aec 100644
--- a/control/json/fan.cpp
+++ b/control/json/fan.cpp
@@ -28,15 +28,6 @@
Fan::Fan(sdbusplus::bus::bus& bus, const json& jsonObj) :
ConfigBase(jsonObj), _bus(bus)
{
- setProfiles(jsonObj);
- setZone(jsonObj);
- setSensors(jsonObj);
- setInterface(jsonObj);
-}
-
-void Fan::setProfiles(const json& jsonObj)
-{
- _profiles = {};
if (jsonObj.contains("profiles"))
{
for (const auto& profile : jsonObj["profiles"])
@@ -44,6 +35,9 @@
_profiles.emplace_back(profile.get<std::string>());
}
}
+ setZone(jsonObj);
+ setSensors(jsonObj);
+ setInterface(jsonObj);
}
void Fan::setZone(const json& jsonObj)