Project

General

Profile

Actions

Bug #14215

closed

file_from_string_mustache GM unwanted behaviour when the mustache template use non-printable elements

Added by Félix DALLIDET almost 6 years ago. Updated over 2 years ago.

Status:
Released
Priority:
N/A
Category:
Generic methods
Target version:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
0
Name check:
Fix check:
Regression:

Description

When using a wrong call in the template given to the generic method, for example, a call to print a key which has subkeys,
cf-engine will fails to render the template BUT it will use the last template rendering value instead...

The generic method should initialize the content of the rendered template, try to expand it via cf-engine, and then check that
it has successfully been changed before writing it to the result file.

Minimal problem showcase is found below:

bundle agent main {
  vars:
    "test" data => '{"key1": "value1" }';
  methods:
    "any1" usebundle => template("/tmp/test1", "content");
    # Exists bot not displayable
    # The value is not recomputed
    "any2" usebundle => template("/tmp/test2", "{{{vars.main}}}");
}

bundle agent template(dest, template) {
  vars:
    "content" string => string_mustache("${template}", datastate());

  reports:
    "${dest}:${content}";
}`
Actions #1

Updated by Félix DALLIDET almost 6 years ago

  • Status changed from New to In progress
  • Assignee set to Félix DALLIDET
Actions #2

Updated by Félix DALLIDET almost 6 years ago

  • Status changed from In progress to Pending technical review
  • Assignee changed from Félix DALLIDET to Alexis Mousset
  • Pull Request set to https://github.com/Normation/ncf/pull/910
Actions #4

Updated by Félix DALLIDET almost 6 years ago

  • Status changed from Pending technical review to Pending release

Applied in changeset commit:62358d9c90a0adcf52ef230370aca0605d25d5eb.

Actions #5

Updated by Alexis Mousset almost 6 years ago

  • Status changed from Pending release to Released
This bug has been fixed in Rudder 4.1.19, 4.3.9 and 5.0.5 which were released today.
Changelog
Changelog
Changelog
Actions #6

Updated by Alexis Mousset over 2 years ago

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

Also available in: Atom PDF