Correct precondition generation

Currently, preconditions must include the set speed event as a
parameter, so the ability to generate a precondition with no parameters
is removed. Related to this, actions without parameters are supported
and was corrected to allow this.

Change-Id: Icf5898e1845cca80bd6bb0332363a0fec2b84a73
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/templates/defs.mako b/control/templates/defs.mako
index b090fb9..e3addbc 100644
--- a/control/templates/defs.mako
+++ b/control/templates/defs.mako
@@ -72,7 +72,11 @@
 },
 std::vector<Action>{
 %for a in e['actions']:
+%if len(a['parameters']) != 0:
 make_action(action::${a['name']}(
+%else:
+make_action(action::${a['name']}
+%endif
 %for i, p in enumerate(a['parameters']):
 %if (i+1) != len(a['parameters']):
     ${p},
@@ -80,7 +84,11 @@
     ${p}
 %endif
 %endfor
+%if len(a['parameters']) != 0:
 )),
+%else:
+),
+%endif
 %endfor
 }},
 %endfor
diff --git a/control/templates/fan_zone_defs.mako.cpp b/control/templates/fan_zone_defs.mako.cpp
index a710a9e..214df56 100644
--- a/control/templates/fan_zone_defs.mako.cpp
+++ b/control/templates/fan_zone_defs.mako.cpp
@@ -114,13 +114,8 @@
                         {Group{},
                         std::vector<Action>{
                         %for i, a in enumerate(event['pc']['pcact']):
-                        %if len(a['params']) != 0:
                         make_action(
                             precondition::${a['name']}(
-                        %else:
-                        make_action(
-                            precondition::${a['name']}
-                        %endif
                         %for p in a['params']:
                         ${p['type']}${p['open']}
                         %for j, v in enumerate(p['values']):
@@ -132,13 +127,6 @@
                         %endfor
                         ${p['close']},
                         %endfor
-                        %if (i+1) != len(event['pc']['pcact']):
-                        %if len(a['params']) != 0:
-                        )),
-                        %else:
-                        ),
-                        %endif
-                        %endif
                         %endfor
                     std::vector<SetSpeedEvent>{
                     %for pcevt in event['pc']['pcevts']:
@@ -154,11 +142,7 @@
                     %endif
                     %if ('pc' in event) and (event['pc'] is not None):
                     }
-                        %if len(event['pc']['pcact'][-1]['params']) != 0:
                         )),
-                        %else:
-                        ),
-                        %endif
                         }},
                         },
                         std::vector<Trigger>{