Project

General

Profile

Actions

Bug #5283

closed

Unhelpful feedback with special string template characters

Added by Lionel Le Folgoc over 10 years ago. Updated about 5 years ago.

Status:
Resolved
Priority:
N/A
Assignee:
-
Category:
Web - Config management
Target version:
Severity:
Minor - inconvenience | misleading | easy workaround
UX impact:
User visibility:
Infrequent - complex configurations | third party integrations
Effort required:
Very Small
Priority:
50
Name check:
Fix check:
Regression:

Description

Hi,

I've tried to use the following promise:

  vars:
    "foo[BAR]" string => "$(const.dollar)([ -f /baz ] && /bin/xargs -a /baz || :)";
  files:
    "/Kegeruneku" 
      edit_line => set_quoted_values("pony.foo");

to insert "$([ -f /baz ] && /bin/xargs -a /baz || :)" in a file.

The policy regeneration failed with a useless error message in the web ui, showing basically an invalid syntax message for all characters in the technique.

Now I know that "&" must be escaped to "\&", but rudder didn't help me. :P
Thanks.

The java exception in the webapp log is huge:

problem parsing template 'anonymous'
line 45:18: expecting '<', found 'F'
    at com.normation.stringtemplate.language.NormationAmpersandTemplateLexer.nextToken(NormationAmpersandTemplateLexer.java:144)
    at antlr.TokenBuffer.fill(TokenBuffer.java:69)
    at antlr.TokenBuffer.LA(TokenBuffer.java:80)
    at antlr.LLkParser.LA(LLkParser.java:52)
    at org.antlr.stringtemplate.language.TemplateParser.template(TemplateParser.java:103)
    at org.antlr.stringtemplate.StringTemplate.breakTemplateIntoChunks(StringTemplate.java:850)
    at org.antlr.stringtemplate.StringTemplate.setTemplate(StringTemplate.java:441)
    at org.antlr.stringtemplate.StringTemplate.<init>(StringTemplate.java:299)
    at com.normation.cfclerk.services.impl.Cf3PromisesFileWriterServiceImpl$$anonfun$writePromisesFiles$1.apply(Cf3PromisesFileWriterServiceImpl.scala:199)
    at com.normation.cfclerk.services.impl.Cf3PromisesFileWriterServiceImpl$$anonfun$writePromisesFiles$1.apply(Cf3PromisesFileWriterServiceImpl.scala:196)
    at scala.collection.immutable.HashSet$HashSet1.foreach(HashSet.scala:153)
    at scala.collection.immutable.HashSet$HashTrieSet.foreach(HashSet.scala:306)
    at com.normation.cfclerk.services.impl.Cf3PromisesFileWriterServiceImpl.writePromisesFiles(Cf3PromisesFileWriterServiceImpl.scala:196)
[...]
problem parsing template 'anonymous'
line 45:18: expecting '<', found 'F'
    at com.normation.stringtemplate.language.NormationAmpersandTemplateLexer.nextToken(NormationAmpersandTemplateLexer.java:144)
    at antlr.TokenBuffer.fill(TokenBuffer.java:69)
    at antlr.TokenBuffer.LA(TokenBuffer.java:80)
    at antlr.LLkParser.LA(LLkParser.java:52)
    at org.antlr.stringtemplate.language.TemplateParser.template(TemplateParser.java:103)
    at org.antlr.stringtemplate.StringTemplate.breakTemplateIntoChunks(StringTemplate.java:850)
    at org.antlr.stringtemplate.StringTemplate.setTemplate(StringTemplate.java:441)
    at org.antlr.stringtemplate.StringTemplate.<init>(StringTemplate.java:299)
    at com.normation.cfclerk.services.impl.Cf3PromisesFileWriterServiceImpl$$anonfun$writePromisesFiles$1.apply(Cf3PromisesFileWriterServiceImpl.scala:199)
    at com.normation.cfclerk.services.impl.Cf3PromisesFileWriterServiceImpl$$anonfun$writePromisesFiles$1.apply(Cf3PromisesFileWriterServiceImpl.scala:196)
    at scala.collection.immutable.HashSet$HashSet1.foreach(HashSet.scala:153)
    at scala.collection.immutable.HashSet$HashTrieSet.foreach(HashSet.scala:306)
    at com.normation.cfclerk.services.impl.Cf3PromisesFileWriterServiceImpl.writePromisesFiles(Cf3PromisesFileWriterServiceImpl.scala:196)
    at com.normation.rudder.services.policies.RudderCf3PromisesFileWriterServiceImpl$$anonfun$com$normation$rudder$services$policies$RudderCf3PromisesFileWriterServiceImpl$$prepareRulesForAgents$2$$anonfun$apply$12.apply(RudderPromiseWriterServiceImpl.scala:198)
    at com.normation.rudder.services.policies.RudderCf3PromisesFileWriterServiceImpl$$anonfun$com$normation$rudder$services$policies$RudderCf3PromisesFileWriterServiceImpl$$prepareRulesForAgents$2$$anonfun$apply$12.apply(RudderPromiseWriterServiceImpl.scala:197)
    at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:772)
    at scala.collection.immutable.Map$Map4.foreach(Map.scala:181)
    at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:771)
    at com.normation.rudder.services.policies.RudderCf3PromisesFileWriterServiceImpl$$anonfun$com$normation$rudder$services$policies$RudderCf3PromisesFileWriterServiceImpl$$prepareRulesForAgents$2.apply(RudderPromiseWriterServiceImpl.scala:197)
[...]
problem parsing template 'anonymous'
line 45:18: expecting '<', found 'F'
    at com.normation.stringtemplate.language.NormationAmpersandTemplateLexer.nextToken(NormationAmpersandTemplateLexer.java:144)
    at antlr.TokenBuffer.fill(TokenBuffer.java:69)
    at antlr.TokenBuffer.LA(TokenBuffer.java:80)
    at antlr.LLkParser.LA(LLkParser.java:52)
    at org.antlr.stringtemplate.language.TemplateParser.template(TemplateParser.java:103)
    at org.antlr.stringtemplate.StringTemplate.breakTemplateIntoChunks(StringTemplate.java:850)
    at org.antlr.stringtemplate.StringTemplate.setTemplate(StringTemplate.java:441)
    at org.antlr.stringtemplate.StringTemplate.<init>(StringTemplate.java:299)
    at com.normation.cfclerk.services.impl.Cf3PromisesFileWriterServiceImpl$$anonfun$writePromisesFiles$1.apply(Cf3PromisesFileWriterServiceImpl.scala:199)
    at com.normation.cfclerk.services.impl.Cf3PromisesFileWriterServiceImpl$$anonfun$writePromisesFiles$1.apply(Cf3PromisesFileWriterServiceImpl.scala:196)
    at scala.collection.immutable.HashSet$HashSet1.foreach(HashSet.scala:153)
    at scala.collection.immutable.HashSet$HashTrieSet.foreach(HashSet.scala:306)
    at com.normation.cfclerk.services.impl.Cf3PromisesFileWriterServiceImpl.writePromisesFiles(Cf3PromisesFileWriterServiceImpl.scala:196)
[...]
problem parsing template 'anonymous'
line 45:18: expecting '<', found 'F'
    at com.normation.stringtemplate.language.NormationAmpersandTemplateLexer.nextToken(NormationAmpersandTemplateLexer.java:144)
    at antlr.TokenBuffer.fill(TokenBuffer.java:69)
    at antlr.TokenBuffer.LA(TokenBuffer.java:80)
    at antlr.LLkParser.LA(LLkParser.java:52)
    at org.antlr.stringtemplate.language.TemplateParser.template(TemplateParser.java:103)
    at org.antlr.stringtemplate.StringTemplate.breakTemplateIntoChunks(StringTemplate.java:850)
    at org.antlr.stringtemplate.StringTemplate.setTemplate(StringTemplate.java:441)
    at org.antlr.stringtemplate.StringTemplate.<init>(StringTemplate.java:299)
    at com.normation.cfclerk.services.impl.Cf3PromisesFileWriterServiceImpl$$anonfun$writePromisesFiles$1.apply(Cf3PromisesFileWriterServiceImpl.scala:199)
    at com.normation.cfclerk.services.impl.Cf3PromisesFileWriterServiceImpl$$anonfun$writePromisesFiles$1.apply(Cf3PromisesFileWriterServiceImpl.scala:196)
    at scala.collection.immutable.HashSet$HashSet1.foreach(HashSet.scala:153)
    at scala.collection.immutable.HashSet$HashTrieSet.foreach(HashSet.scala:306)
    at com.normation.cfclerk.services.impl.Cf3PromisesFileWriterServiceImpl.writePromisesFiles(Cf3PromisesFileWriterServiceImpl.scala:196)
[...]


Related issues 2 (0 open2 closed)

Related to Rudder - User story #5284: Rudder should accept vanilla CFEngine without errorRejectedActions
Related to Rudder - Bug #2933: The use of "&&" prevent Rudder to generate promises if not escaped, then a test in the techniques is neededReleasedNicolas PERRON2012-09-27Actions
Actions #1

Updated by François ARMAND over 10 years ago

Thank you, that is a really nice stacktrace. I'm wondering why the world don't like java so much, it is really trying hard to be friendly.

So, there is two problem:

- we never ever want a Rudder user to see a stacktrace. We are trying to keep them happy, stacktrace does not fullfill that job.
=> handle that kind of error in a nice message that helps the user.

- we should NOT make standard CFEngine not working on Rudder. That's just the worst surprise effect possible. As an Rudder user, I want to be able to just copy/paste my working CFEngine promise to start a Technique. This is tracked in #5284.

Actions #2

Updated by Benoît PECCATTE over 9 years ago

  • Category set to Web - Config management
  • Target version set to 2.10.14
Actions #3

Updated by Vincent MEMBRÉ over 9 years ago

  • Target version changed from 2.10.14 to 2.10.15
Actions #4

Updated by Vincent MEMBRÉ over 9 years ago

  • Target version changed from 2.10.15 to 2.10.16
Actions #5

Updated by Vincent MEMBRÉ over 9 years ago

  • Target version changed from 2.10.16 to 2.10.17
Actions #6

Updated by Vincent MEMBRÉ over 9 years ago

  • Target version changed from 2.10.17 to 2.10.18
Actions #7

Updated by Vincent MEMBRÉ about 9 years ago

  • Target version changed from 2.10.18 to 2.10.19
Actions #8

Updated by Vincent MEMBRÉ about 9 years ago

  • Target version changed from 2.10.19 to 2.10.20
Actions #9

Updated by Vincent MEMBRÉ about 9 years ago

  • Target version changed from 2.10.20 to 277
Actions #10

Updated by Vincent MEMBRÉ about 9 years ago

  • Target version changed from 277 to 2.11.18
Actions #11

Updated by Vincent MEMBRÉ almost 9 years ago

  • Target version changed from 2.11.18 to 2.11.19
Actions #12

Updated by Vincent MEMBRÉ almost 9 years ago

  • Target version changed from 2.11.19 to 2.11.20
Actions #13

Updated by Vincent MEMBRÉ over 8 years ago

  • Target version changed from 2.11.20 to 2.11.21
Actions #14

Updated by Vincent MEMBRÉ over 8 years ago

  • Target version changed from 2.11.21 to 2.11.22
Actions #15

Updated by Vincent MEMBRÉ over 8 years ago

  • Target version changed from 2.11.22 to 2.11.23
Actions #16

Updated by Vincent MEMBRÉ over 8 years ago

  • Target version changed from 2.11.23 to 2.11.24
Actions #17

Updated by Vincent MEMBRÉ over 8 years ago

  • Target version changed from 2.11.24 to 308
Actions #18

Updated by Vincent MEMBRÉ over 8 years ago

  • Target version changed from 308 to 3.1.14
Actions #19

Updated by Vincent MEMBRÉ about 8 years ago

  • Target version changed from 3.1.14 to 3.1.15
Actions #20

Updated by Vincent MEMBRÉ about 8 years ago

  • Target version changed from 3.1.15 to 3.1.16
Actions #21

Updated by Vincent MEMBRÉ about 8 years ago

  • Target version changed from 3.1.16 to 3.1.17
Actions #22

Updated by Vincent MEMBRÉ about 8 years ago

  • Target version changed from 3.1.17 to 3.1.18
Actions #23

Updated by Vincent MEMBRÉ almost 8 years ago

  • Target version changed from 3.1.18 to 3.1.19
Actions #24

Updated by François ARMAND over 7 years ago

  • Description updated (diff)
  • Severity set to Minor - inconvenience | misleading | easy workaround
  • User visibility set to Infrequent - complex configurations | third party integrations
  • Priority set to 0
Actions #25

Updated by Vincent MEMBRÉ over 7 years ago

  • Target version changed from 3.1.19 to 3.1.20
Actions #26

Updated by Vincent MEMBRÉ over 7 years ago

  • Target version changed from 3.1.20 to 3.1.21
Actions #27

Updated by François ARMAND over 7 years ago

  • Severity changed from Minor - inconvenience | misleading | easy workaround to Major - prevents use of part of Rudder | no simple workaround
  • Priority changed from 0 to 21
Actions #28

Updated by Vincent MEMBRÉ over 7 years ago

  • Target version changed from 3.1.21 to 3.1.22
Actions #29

Updated by Benoît PECCATTE over 7 years ago

  • Priority changed from 21 to 34
Actions #30

Updated by Vincent MEMBRÉ over 7 years ago

  • Target version changed from 3.1.22 to 3.1.23
Actions #31

Updated by Vincent MEMBRÉ over 7 years ago

  • Target version changed from 3.1.23 to 3.1.24
  • Priority changed from 34 to 35
Actions #32

Updated by Vincent MEMBRÉ about 7 years ago

  • Target version changed from 3.1.24 to 3.1.25
Actions #33

Updated by Vincent MEMBRÉ about 7 years ago

  • Target version changed from 3.1.25 to 387
Actions #34

Updated by Vincent MEMBRÉ about 7 years ago

  • Target version changed from 387 to 4.1.10
  • Priority changed from 35 to 36
Actions #35

Updated by Vincent MEMBRÉ almost 7 years ago

  • Target version changed from 4.1.10 to 4.1.11
Actions #36

Updated by Vincent MEMBRÉ over 6 years ago

  • Target version changed from 4.1.11 to 4.1.12
  • Priority changed from 36 to 37
Actions #37

Updated by Vincent MEMBRÉ over 6 years ago

  • Target version changed from 4.1.12 to 4.1.13
Actions #38

Updated by Vincent MEMBRÉ over 6 years ago

  • Target version changed from 4.1.13 to 4.1.14
  • Priority changed from 37 to 38
Actions #39

Updated by Benoît PECCATTE over 6 years ago

  • Target version changed from 4.1.14 to 4.1.15
Actions #40

Updated by Vincent MEMBRÉ about 6 years ago

  • Target version changed from 4.1.15 to 4.1.16
Actions #41

Updated by Vincent MEMBRÉ about 6 years ago

  • Target version changed from 4.1.16 to 4.1.17
  • Priority changed from 38 to 39
Actions #42

Updated by Vincent MEMBRÉ about 6 years ago

  • Target version changed from 4.1.17 to 4.1.18
Actions #43

Updated by Vincent MEMBRÉ almost 6 years ago

  • Target version changed from 4.1.18 to 4.1.19
Actions #44

Updated by Alexis Mousset almost 6 years ago

  • Target version changed from 4.1.19 to 4.1.20
Actions #45

Updated by Alexis Mousset over 5 years ago

  • Target version changed from 4.1.20 to 588
  • Priority changed from 39 to 41
Actions #46

Updated by Nicolas CHARLES over 5 years ago

  • Target version changed from 588 to 5.0.13
  • Severity changed from Major - prevents use of part of Rudder | no simple workaround to Minor - inconvenience | misleading | easy workaround
  • Priority changed from 41 to 22

this is most likely still the case, but we do have a linter for that #2933

Actions #47

Updated by Nicolas CHARLES over 5 years ago

  • Related to Bug #2933: The use of "&&" prevent Rudder to generate promises if not escaped, then a test in the techniques is needed added
Actions #48

Updated by Vincent MEMBRÉ over 5 years ago

  • Target version changed from 5.0.13 to 5.0.14
Actions #49

Updated by Vincent MEMBRÉ about 5 years ago

  • Target version changed from 5.0.14 to 5.0.15
Actions #50

Updated by François ARMAND about 5 years ago

  • Effort required set to Very Small
  • Priority changed from 22 to 50

We should just catch that exception and write a nice message like "Perhaps you forgot to escape an &" (and then the exception message)

Actions #51

Updated by François ARMAND about 5 years ago

  • Status changed from New to Resolved

It now reports:

problem parsing template 'anonymous'
line 1:51: unexpected char: '&'

Which seems perfectly fine.

Actions

Also available in: Atom PDF