Remove events with no groups defined
Change-Id: I36422decf77626df6265b99462e4d97e6ff11946
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/gen-fan-zone-defs.py b/control/gen-fan-zone-defs.py
index 2cc93fc..4d310b9 100755
--- a/control/gen-fan-zone-defs.py
+++ b/control/gen-fan-zone-defs.py
@@ -532,7 +532,7 @@
del eAction['groups']
actList = []
actList.append(eAction)
- sseActions.append({'groups':grps, 'actions':actList})
+ sseActions.append({'groups': grps, 'actions': actList})
event['action'] = sseActions
# Add event triggers
@@ -652,7 +652,11 @@
events_data)
else:
event = getEvent(zone_num, zone_conditions, e, events_data)
- if not event:
+ # Remove empty events and events that have
+ # no groups defined for the event or any of the actions
+ if not event or \
+ (not event['groups'] and
+ all(not a['groups'] for a in event['action'])):
continue
events.append(event)