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/missing_owner_target.cpp b/control/json/actions/missing_owner_target.cpp
index 4ba33ab..68f6614 100644
--- a/control/json/actions/missing_owner_target.cpp
+++ b/control/json/actions/missing_owner_target.cpp
@@ -39,20 +39,23 @@
setTarget(jsonObj);
}
-void MissingOwnerTarget::run(Zone& zone, const Group& group)
+void MissingOwnerTarget::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.setTarget(_target);
+ 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.setTarget(_target);
+ }
+ // Update group's fan control active allowed based on action results
+ zone.setActiveAllow(group.getName(), !isMissingOwner);
}
- // Update group's fan control active allowed based on action results
- zone.setActiveAllow(group.getName(), !isMissingOwner);
}
void MissingOwnerTarget::setTarget(const json& jsonObj)