Project

General

Profile

« Previous | Next » 

Revision 96c47ada

Added by Nicolas CHARLES over 6 years ago

Fixes #11087: File content (key/value format) technique allows white space before separator but not after it

View differences:

techniques/fileDistribution/manageKeyValueFile/1.0/metadata.xml
<!-- This technique lets user define a key-value in a file -->
<TECHNIQUE name="Manage keys-values in file">
<DEPRECATED>This technique version has been superseded by a new version. It will no longer be available in the next stable version of Rudder. Please upgrade to the latest version.</DEPRECATED>
<DESCRIPTION>Manage keys-values in file</DESCRIPTION>
<MULTIINSTANCE>true</MULTIINSTANCE>
<COMPATIBLE>
techniques/fileDistribution/manageKeyValueFile/1.1/manage-key-value-file.st
&MANAGE_KEY_VALUE_VALUE:{value | "value[&i&]" string => "&value&";
}&
&MANAGE_KEY_VALUE_SEPARATOR:{separator | "separator[&i&]" string => "&separator&";
}&
&MANAGE_KEY_VALUE_OPTION:{option | "option[&i&]" string => "&option&";
}&
&TRACKINGKEY:{uuid | "trackingkey[&i&]" string => "&uuid&";
}&
......
"canonified_file[${index}]" string => canonify("${file[${index}]}");
"class_prefix_${index}" string => "file_ensure_key_value_${canonified_file[${index}]}";
"technique_name" string => "Manage keys-values file";
methods:
"apply_${index}" usebundle => file_ensure_key_value("${file[${index}]}", "${key[${index}]}", "${value[${index}]}", "${separator[${index}]}");
"report_${index}" usebundle => rudder_common_reports_generic_index("${technique_name}", "${class_prefix_${index}}", "${trackingkey[${index}]}", "File", "${file[${index}]}", "The key -> value ${key[${index}]} ${separator[${index}]} ${value[${index}]}", "${index}");
"apply_${index}" usebundle => file_ensure_key_value_option("${file[${index}]}", "${key[${index}]}", "${value[${index}]}", "${separator[${index}]}", "${option[${index}]}");
"report_${index}" usebundle => rudder_common_reports_generic_index("${technique_name}", "${class_prefix_${index}}", "${trackingkey[${index}]}", "File", "${file[${index}]}", "The key -> value ${key[${index}]} ${separator[${index}]} ${value[${index}]} with ${option[${index}]} spacing around the separator", "${index}");
}
techniques/fileDistribution/manageKeyValueFile/1.1/metadata.xml
<TYPE>string</TYPE>
</CONSTRAINT>
</INPUT>
<SELECT1>
<NAME>MANAGE_KEY_VALUE_OPTION</NAME>
<DESCRIPTION>Prevent spaces around separator</DESCRIPTION>
<LONGDESCRIPTION>If "No spacing" is selected, this will prevent any spaces around the separator, enforcing strictly KEY=VALUE; otherwise any number of spaces will be accepted before or after the separator.</LONGDESCRIPTION>
<ITEM>
<VALUE>strict</VALUE>
<LABEL>No spacing</LABEL>
</ITEM>
<ITEM>
<VALUE>lax</VALUE>
<LABEL>Any number of spaces</LABEL>
</ITEM>
<CONSTRAINT>
<DEFAULT>lax</DEFAULT>
</CONSTRAINT>
</SELECT1>
</SECTION>
</SECTION>
</SECTIONS>

Also available in: Unified diff