control: Allow `zone_conditions` to not be in yaml
The `zone_conditions` yaml config key was intended to be optional,
however it was still being required in the `zone_configuration` entry.
This removes it from being required in the yaml even if it was empty.
Tested:
Generated source correctly without `zone_conditions`
Generated current machine(wspoon) config without effecting output
No `zone_configuration` produces empty generated config
Change-Id: Ib3247d701a1fd63f7f3aeacb630d1d852e188479
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 f30a1a7..733a29b 100755
--- a/control/gen-fan-zone-defs.py
+++ b/control/gen-fan-zone-defs.py
@@ -786,6 +786,9 @@
zone_groups = []
+ # Allow zone_conditions to not be in yaml (since its optional)
+ if not isinstance(zone_data, list) and zone_data != {}:
+ zone_data = [zone_data]
for group in zone_data:
conditions = []
# zone conditions are optional
@@ -843,7 +846,8 @@
ifaces = getIfacesInZone(z['interfaces'])
fans = getFansInZone(z['zone'], profiles, fan_data)
- events = getEventsInZone(z['zone'], group['zone_conditions'],
+ events = getEventsInZone(z['zone'],
+ group.get('zone_conditions', {}),
events_data)
if len(fans) == 0: