Bug #25429
closedWhen a mandatory variable has not value but a default one is configured, use it
Description
For now, the "default" value in technique metadata is only use to set the first initial value on a directive field.
Sometime, for example during migration, a new mandatory variable is added to a technique and directive already exists.
When we set that variable with a default value, we still get a generation error because the default value is not use, because there wasn't a loop throught updating the directive which would allow to provide the directive with the value.
We want to change that and just use the default value if:
- the variable is mandatory,
- it has no value (or only empty value, which is the same in Rudder).
We won't change anything for an optional variable with a default value. In that case, it's still possible to use an empty value.
The effect of that change is that the technique creator can choose to avoid user to go all of their existing technique and update them and still ask for a mandatory value.
The current alternative is to mark the variable as optionnal and check in the cfengine/powershell code for the availability of a value, and use the default here (which is more involving and duplicate the work).