Project

General

Profile

Actions

Bug #10716

closed

sharedfile_to_node broken if file is updated after shared

Added by Janos Mattyasovszky almost 7 years ago. Updated almost 2 years ago.

Status:
Released
Priority:
N/A
Category:
Generic methods
Target version:
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";


Subtasks 1 (0 open1 closed)

Bug #10925: Broken syntax in CFEngine 3.6ReleasedNicolas CHARLESActions
Actions #1

Updated by François ARMAND almost 7 years ago

  • Priority changed from 0 to 36
Actions #2

Updated by François ARMAND almost 7 years ago

  • Target version set to master
Actions #3

Updated by Alexis Mousset almost 7 years ago

  • Status changed from New to In progress
  • Assignee set to Alexis Mousset
Actions #4

Updated by Alexis Mousset almost 7 years ago

  • Status changed from In progress to Pending technical review
  • Assignee changed from Alexis Mousset to Benoît PECCATTE
  • Pull Request set to https://github.com/Normation/ncf/pull/589
Actions #5

Updated by Alexis Mousset almost 7 years ago

  • Status changed from Pending technical review to Pending release

Applied in changeset commit:b445cf663086f52afca2b3f7ed3c44ac2a3f86c2.

Actions #6

Updated by Janos Mattyasovszky almost 7 years ago

Applied in changeset commit:0fd79e4fc12cb453efc26ba340c8c6072a844290.

Actions #7

Updated by Vincent MEMBRÉ over 6 years ago

  • Status changed from Pending release to Released
  • Priority changed from 36 to 48
Actions #8

Updated by Alexis Mousset almost 2 years ago

  • Target version changed from master to ncf-1.2
  • Priority changed from 48 to 0
Actions #9

Updated by Alexis Mousset almost 2 years ago

  • Project changed from 41 to Rudder
  • Category changed from Generic methods to Generic methods
Actions

Also available in: Atom PDF