How do I migrate from a bakery ruleset that used DropdownChoice() to the rulesets.v1 API with Dictionary()?
The documentation has this example for a simple bakery ruleset:
def _parameter_form_bakery():
return Dictionary(
elements = {}
)
The dictionary obviously does not need any elements because we just want to bake the plugin into the agent package.
In the past I used something like this:
def _valuespec_agent_config_apcaccess():
return DropdownChoice(
title = _("APC UPS via apcaccess (Linux, Windows)"),
help = _("This will deploy the agent plugin <tt>apcaccess</tt> to check various APC UPS stats."),
choices = [
( True, _("Deploy plugin for APC UPS") ),
( None, _("Do not deploy plugin for APC UPS") ),
]
)
because this made it possible to not deploy the agent plugin to specific hosts. Now only âTrueâ is stored as rule value in rules.mk. And a migrate function does not get this value, the GUI only tells me: âThe value of this rule is not valid. Trueâ.
Should I replace the DropdownChoice with SingleChoice?