Actions
Bug #10716
closedsharedfile_to_node broken if file is updated after shared
Pull Request:
Severity:
Major - prevents use of part of Rudder | no simple workaround
UX impact:
User visibility:
Operational - other Techniques | Technique editor | Rudder settings
Effort required:
Priority:
0
Name check:
Fix check:
Regression:
Description
If you use sharedfile_to_node, and the files shared if updated (changed), the hash/signature is not updated.
"hash" string => execresult("sed -n '/^hash_value=/s/^hash_value=//p' ${file_path}.sign", "useshell"), ifvarclass => "${canonified_path}_signed"; [...] "${canonified_path}_signed" expression => fileexists("${file_path}.sign");
"hash" should also include a function like isnewerthan
to see if the shared file is newer than the signature file, and recreate it if the file changed.
This patch helped me to solve the issue:
# diff sharedfile_to_node.cf.original sharedfile_to_node.cf -u --- sharedfile_to_node.cf.original 2017-05-08 17:07:47.219231912 +0200 +++ sharedfile_to_node.cf 2017-05-08 17:18:06.953508589 +0200 @@ -123,7 +123,7 @@ "pass3" expression => "pass2"; "pass2" expression => "pass1"; "pass1" expression => "any"; - "${canonified_path}_signed" expression => fileexists("${file_path}.sign"); + "${canonified_path}_signed" expression => and( fileexists("${file_path}.sign"), isnewerthan("${file_path}.sign","${file_path}") ); # classes for _classes_combine_ifthenelse "${old_class_prefix}_exist_true" expression => "${old_class_prefix}_exist_kept";
Actions