User story #3014
Updated by Nicolas CHARLES almost 12 years ago
When we use an optionnal fields in Technique, there are two differents behaviour that are confusing : # if there is only one value for this field, and it is empty, the generated value is On Rudder 2.4.0~beta6 nightly, with Enforce File Content v3.0, a "null" (nothing) # if there are several values for this fields, all the empty values are replaced by "" (empty string) This lead to unexpected behaviour, as both are clearly different We should clarify this behaviour, surely by having one "optional" field that replaced empty value by "" , and on that is replaced by null and that can't bug about CFEngine generation could be multivalued Under is a technical details of what happen on the technique generatin side trigger. Using the same parameters than the files: * *EnforceFileContentExpandVarBug1.png* * *EnforceFileContentExpandVarBug2.png* It will lead to a CFEngine promise generated without variable *generic_file_content_modification_destination*: <pre> debian-5-64:~# grep 'generic_file_content_modification_destination' /var/rudder/cfengine-community/inputs/checkGenericFileContent/3.0/checkGenericFileContent.cf "replacement_dest_defined_$(index)" expression => isvariable("generic_file_content_modification_destination[$(index)]"); edit_line => set_arbitrary_file_content_modify("$(generic_file_content_modification_regexp[$(index)])", "$(generic_file_content_modification_destination[$(index)])"), </pre> Adding a new Directive with the same parameters than the files: * *EnforceFileContentExpandVarBug1.png* * *EnforceFileContentExpandVarBug1.png* <pre> debian-5-64:~# grep 'generic_file_content_modification_destination' /var/rudder/cfengine-community/inputs/checkGenericFileContent/3.0/checkGenericFileContent.cf "generic_file_content_modification_destination[1]" string => ""; "generic_file_content_modification_destination[2]" string => ""; "replacement_dest_defined_$(index)" expression => isvariable("generic_file_content_modification_destination[$(index)]"); edit_line => set_arbitrary_file_content_modify("$(generic_file_content_modification_regexp[$(index)])", "$(generic_file_content_modification_destination[$(index)])"), </pre> It seems that this is linked to the application instead of the Techniques (#2819).