Revision 80b785c1
Added by Benoît PECCATTE about 6 years ago
maintained-techniques | ||
---|---|---|
fileDistribution/fileTemplate/1.0
|
||
fileDistribution/manageKeyValueFile/1.0
|
||
fileDistribution/manageKeyValueFile/1.1
|
||
fileDistribution/manageKeyValueFile/1.3
|
||
jobScheduling/jobScheduler/1.0
|
||
jobScheduling/jobScheduler/2.0
|
||
system/common/1.0
|
techniques/fileDistribution/manageKeyValueFile/1.3/manage-key-value-file.st | ||
---|---|---|
&MANAGE_KEY_VALUE_SEPARATOR:{separator | "separator[&i&]" string => "&separator&";
|
||
}&
|
||
&MANAGE_KEY_VALUE_OPTION:{option | "option[&i&]" string => "&option&";
|
||
}&
|
||
&MANAGE_KEY_VALUE_POST_HOOK_COMMAND:{post_hook | "post_hook[&i&]" string => "&post_hook&";
|
||
}&
|
||
&TRACKINGKEY:{uuid | "trackingkey[&i&]" string => "&uuid&";
|
||
}&
|
||
... | ... | |
"index" slist => getindices("file");
|
||
|
||
"canonified_file[${index}]" string => canonify("${file[${index}]}");
|
||
"canonified_hook[${index}]" string => canonify("${post_hook[${index}]}");
|
||
"class_prefix_${index}" string => "file_ensure_key_value_${canonified_file[${index}]}";
|
||
"hook_class_prefix_${index}" string => "command_execution_${canonified_hook[${index}]}";
|
||
"technique_name" string => "Manage keys-values file";
|
||
|
||
classes:
|
||
"hook_empty_${index}" expression => strcmp("${post_hook[${index}]}", "");
|
||
|
||
methods:
|
||
"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}");
|
||
"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}");
|
||
|
||
# call post-hooks
|
||
"apply_${index}" usebundle => command_execution("${post_hook[${index}]}"),
|
||
ifvarclass => "!hook_empty_${index}.${class_prefix_${index}}_repaired";
|
||
"na_report" usebundle => _classes_noop("${hook_class_prefix_${index}}"),
|
||
ifvarclass => "hook_empty_${index}|${class_prefix_${index}}_kept|${class_prefix_${index}}_error";
|
||
"report_${index}" usebundle => rudder_common_reports_generic_index("${technique_name}", "${hook_class_prefix_${index}}", "${trackingkey[${index}]}", "Post-modification script", "${file[${index}]}", "The hook '${post_hook[${index}]}'", "${index}");
|
||
|
||
}
|
techniques/fileDistribution/manageKeyValueFile/1.3/metadata.xml | ||
---|---|---|
</CONSTRAINT>
|
||
</SELECT1>
|
||
</SECTION>
|
||
<SECTION name="Post-modification script" component="true" componentKey="MANAGE_KEY_VALUE_FILEPATH">
|
||
<INPUT>
|
||
<NAME>MANAGE_KEY_VALUE_POST_HOOK_COMMAND</NAME>
|
||
<DESCRIPTION>Command to run after changes on one file</DESCRIPTION>
|
||
<CONSTRAINT>
|
||
<TYPE>textarea</TYPE>
|
||
<MAYBEEMPTY>true</MAYBEEMPTY>
|
||
</CONSTRAINT>
|
||
</INPUT>
|
||
</SECTION>
|
||
</SECTION>
|
||
</SECTIONS>
|
||
</TECHNIQUE>
|
Also available in: Unified diff
Fixes #12124: Add post-hook to the manage key-value file techniques