Project

General

Profile

Actions

Bug #12674

closed

Policies regeneration error when using a parameters with " char

Bug #12674: Policies regeneration error when using a parameters with " char

Added by Vincent DAVY over 7 years ago. Updated over 7 years ago.

Status:
Released
Priority:
N/A
Category:
Web - Config management
Target version:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
0
Name check:
Fix check:
Regression:

Description

If I create a parameter (in menu "Configuration policy > Parameters") with a value containing a " char, and then I use the parameter in a directive, I got a policies regeneration error.
Here is a sample :

Policy update error for process '197' at 2018-05-22 10:12:35 <- Cannot write configuration node <- Exit code=1 for hook: '/opt/rudder/etc/hooks.d/policy-generation-node-ready/10-cf-promise-check'.
 stdout:    error: There are syntax errors in policy files

 stderr: '/var/rudder/share/fae5f18c-a543-4ed2-9a74-0a8991017bbf/rules.new/cfengine-community/common/1.0/rudder-parameters.cf:42:27: error: syntax error
   "test" string => "'"toto"'";
                          ^
/var/rudder/share/fae5f18c-a543-4ed2-9a74-0a8991017bbf/rules.new/cfengine-community/common/1.0/rudder-parameters.cf:42:27: error: Check previous line, Expected ',', got 'toto'
   "test" string => "'"toto"'";
                          ^
/var/rudder/share/fae5f18c-a543-4ed2-9a74-0a8991017bbf/rules.new/cfengine-community/common/1.0/rudder-parameters.cf:42:30: error: Expected promiser string, got '"'"'
   "test" string => "'"toto"'";

The global log is attached to this report.

I got the error after a upgrade from 4.3.0 rc to 4.3.1 installed through debian packages.

Seems to be a bit equivalent to this : https://www.rudder-project.org/redmine/issues/12101


Files

error.txt (28 KB) error.txt Vincent DAVY, 2018-05-22 09:19

Subtasks 1 (0 open1 closed)

Bug #12679: Add a test for escaped " in promise writerReleasedFrançois ARMANDActions

Related issues 2 (0 open2 closed)

Related to Rudder - Bug #12101: Escaping issue in Users Technique ParameterReleasedFrançois ARMANDActions
Related to Rudder - Bug #12390: (breaking change) In Windows Agent, a '\' in a directive parameter value is escaped but it should notReleasedFrançois ARMANDActions

Updated by Alexis Mousset over 7 years ago Actions #1

  • Related to Bug #12101: Escaping issue in Users Technique Parameter added

Updated by Vincent DAVY over 7 years ago Actions #2

Using a single quote ' works. Using a double quote " is giving errors

Updated by Vincent DAVY over 7 years ago Actions #3

Here is a step by step guide to reproduce (please apologize my frenglish) :
1. Install Rudder in a Virtualbox following this guide using a Debian 9 base OS
2. Login into Rudder interface with admin password
3. Go to "Configuration policy > Parameters", create a "test" parameter and enter a value with a double quote (example : "toto")
4. Go to "Configuration policy > Directives", create a new "File content" directive with a file path /root/toto and use ${rudder.param.test} for file content (referencing the created param)
5. Go to "Configuration polocy > Rules" and create a new rule using the previously created directive and applying it on all nodes (for exemple)
6. Check the status with the heart logo in the top right corner near the "documentation" link : the heart is sick with a red cross on it asking you to check the status, click on it
7. You got an "Error during policy update"
8. click on "Details". You got this error :

⇨ Policy update error for process '6' at 2018-05-22 12:05:19 
⇨ Cannot write configuration node 
⇨ Exit code=1 for hook: '/opt/rudder/etc/hooks.d/policy-generation-node-ready/10-cf-promise-check'.
stdout: 
stderr: '/var/rudder/cfengine-community/inputs.new/common/1.0/rudder-parameters.cf:49:740: error: syntax error
"test" string => "test"";
^
/var/rudder/cfengine-community/inputs.new/common/1.0/rudder-parameters.cf:49:740: error: Check previous line, Expected ';', got '";

}

You can get the full error in the logs (Menu "Utilities > Event logs")

Hope this guide can help.

Updated by François ARMAND over 7 years ago Actions #4

  • Project changed from Rudder websites to Rudder

Updated by Nicolas CHARLES over 7 years ago Actions #5

  • Target version set to 410

This happens only in Rudder 4.3 (works as expected in 4.1 and 4.2)

Updated by Nicolas CHARLES over 7 years ago Actions #6

  • Target version changed from 410 to 4.2.7

actually, 4.2.5 is broken also (4.2.4 is fine)

Updated by Nicolas CHARLES over 7 years ago Actions #7

  • Related to Bug #12390: (breaking change) In Windows Agent, a '\' in a directive parameter value is escaped but it should not added

Updated by Nicolas CHARLES over 7 years ago Actions #8

This is most likely introduced by #12390

Updated by François ARMAND over 7 years ago Actions #9

  • Status changed from New to In progress
  • Assignee set to François ARMAND

Updated by François ARMAND over 7 years ago Actions #10

  • Status changed from In progress to Pending technical review
  • Assignee changed from François ARMAND to Nicolas CHARLES
  • Pull Request set to https://github.com/Normation/rudder/pull/1941

Updated by François ARMAND over 7 years ago Actions #11

In windows, it does nothing as we don't have a "rudder-parameters" file.

Updated by Rudder Quality Assistant over 7 years ago Actions #12

  • Assignee changed from Nicolas CHARLES to François ARMAND

Updated by François ARMAND over 7 years ago Actions #13

  • Status changed from Pending technical review to Pending release

Updated by Vincent MEMBRÉ over 7 years ago Actions #14

  • Target version changed from 4.2.7 to 4.2.6

Updated by Benoît PECCATTE over 7 years ago Actions #15

  • Status changed from Pending release to Released

This bug has been fixed in Rudder 4.2.6 and 4.3.1 which were released today.

Updated by Vincent MEMBRÉ over 7 years ago Actions #16

  • Category set to Web - Config management
Actions

Also available in: PDF Atom