Project

General

Profile

Actions

User story #3014

closed

Optionnal variables should not be nulled (if they are not system variables)

Added by Nicolas PERRON over 11 years ago. Updated about 9 years ago.

Status:
Released
Priority:
N/A
Category:
Web - Config management
Target version:
UX impact:
Suggestion strength:
User visibility:
Effort required:
Name check:
Fix check:
Regression:

Description

When we use an optionnal fields in Technique, there are two differents behaviour that are confusing :
  1. if there is only one value for this field, and it is empty, the generated value is a "null" (nothing)
  2. 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 be multivalued

Under is a technical details of what happen on the technique generatin side
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:

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)])"),
Adding a new Directive with the same parameters than the files:
  • EnforceFileContentExpandVarBug1.png
  • EnforceFileContentExpandVarBug1.png
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)])"),

It seems that this is linked to the application instead of the Techniques (#2819).


Files

EnforceFileContentExpandVarBug1.png (44.5 KB) EnforceFileContentExpandVarBug1.png Parameters of the Directive A 1/2 Nicolas PERRON, 2012-11-19 17:31
EnforceFileContentExpandVarBug2.png (50.8 KB) EnforceFileContentExpandVarBug2.png Parameters of the Directive A 2/2 Nicolas PERRON, 2012-11-19 17:31
EnforceFileContentExpandVarBug3.png (44 KB) EnforceFileContentExpandVarBug3.png Parameters of the Directive B 1/2 Nicolas PERRON, 2012-11-19 17:31
EnforceFileContentExpandVarBug4.png (50.1 KB) EnforceFileContentExpandVarBug4.png Parameters of the Directive B 2/2 Nicolas PERRON, 2012-11-19 17:31

Subtasks 1 (0 open1 closed)

User story #5303: Use empty ("") value in place of null for variable that has the attribute maybeemptyReleasedFrançois ARMAND2014-07-24Actions
Actions

Also available in: Atom PDF