control: Actions use list of groups set on base object
Remove the reference to a group given when running an action and instead
have each action iterate over the list of groups configured/set on the
base action object. The group configured/set on the base action object
is the only set of groups that the action should use based on its
configuration in an event.
Change-Id: Ia298d270e782ad729b5a29f9cdfe9b6c9ea4bc45
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/json/actions/default_floor.cpp b/control/json/actions/default_floor.cpp
index 360cc17..5ca3c10 100644
--- a/control/json/actions/default_floor.cpp
+++ b/control/json/actions/default_floor.cpp
@@ -35,20 +35,23 @@
// There are no JSON configuration parameters for this action
}
-void DefaultFloor::run(Zone& zone, const Group& group)
+void DefaultFloor::run(Zone& zone)
{
- const auto& members = group.getMembers();
- auto isMissingOwner =
- std::any_of(members.begin(), members.end(),
- [&intf = group.getInterface()](const auto& member) {
- return !Manager::hasOwner(member, intf);
- });
- if (isMissingOwner)
+ for (const auto& group : _groups)
{
- zone.setFloor(zone.getDefaultFloor());
+ const auto& members = group.getMembers();
+ auto isMissingOwner =
+ std::any_of(members.begin(), members.end(),
+ [&intf = group.getInterface()](const auto& member) {
+ return !Manager::hasOwner(member, intf);
+ });
+ if (isMissingOwner)
+ {
+ zone.setFloor(zone.getDefaultFloor());
+ }
+ // Update fan control floor change allowed
+ zone.setFloorChangeAllow(group.getName(), !isMissingOwner);
}
- // Update fan control floor change allowed
- zone.setFloorChangeAllow(group.getName(), !isMissingOwner);
}
} // namespace phosphor::fan::control::json