Project

General

Profile

Actions

Bug #5283

closed

Unhelpful feedback with special string template characters

Bug #5283: Unhelpful feedback with special string template characters

Added by Lionel Le Folgoc over 11 years ago. Updated over 6 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 PERRONActions

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

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.

Updated by Benoît PECCATTE almost 11 years ago Actions #2

  • Category set to Web - Config management
  • Target version set to 2.10.14

Updated by Vincent MEMBRÉ almost 11 years ago Actions #3

  • Target version changed from 2.10.14 to 2.10.15

Updated by Vincent MEMBRÉ almost 11 years ago Actions #4

  • Target version changed from 2.10.15 to 2.10.16

Updated by Vincent MEMBRÉ over 10 years ago Actions #5

  • Target version changed from 2.10.16 to 2.10.17

Updated by Vincent MEMBRÉ over 10 years ago Actions #6

  • Target version changed from 2.10.17 to 2.10.18

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

  • Target version changed from 2.10.18 to 2.10.19

Updated by Vincent MEMBRÉ over 10 years ago Actions #8

  • Target version changed from 2.10.19 to 2.10.20

Updated by Vincent MEMBRÉ over 10 years ago Actions #9

  • Target version changed from 2.10.20 to 277

Updated by Vincent MEMBRÉ over 10 years ago Actions #10

  • Target version changed from 277 to 2.11.18

Updated by Vincent MEMBRÉ about 10 years ago Actions #11

  • Target version changed from 2.11.18 to 2.11.19

Updated by Vincent MEMBRÉ about 10 years ago Actions #12

  • Target version changed from 2.11.19 to 2.11.20

Updated by Vincent MEMBRÉ about 10 years ago Actions #13

  • Target version changed from 2.11.20 to 2.11.21

Updated by Vincent MEMBRÉ almost 10 years ago Actions #14

  • Target version changed from 2.11.21 to 2.11.22

Updated by Vincent MEMBRÉ almost 10 years ago Actions #15

  • Target version changed from 2.11.22 to 2.11.23

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

  • Target version changed from 2.11.23 to 2.11.24

Updated by Vincent MEMBRÉ over 9 years ago Actions #17

  • Target version changed from 2.11.24 to 308

Updated by Vincent MEMBRÉ over 9 years ago Actions #18

  • Target version changed from 308 to 3.1.14

Updated by Vincent MEMBRÉ over 9 years ago Actions #19

  • Target version changed from 3.1.14 to 3.1.15

Updated by Vincent MEMBRÉ over 9 years ago Actions #20

  • Target version changed from 3.1.15 to 3.1.16

Updated by Vincent MEMBRÉ over 9 years ago Actions #21

  • Target version changed from 3.1.16 to 3.1.17

Updated by Vincent MEMBRÉ over 9 years ago Actions #22

  • Target version changed from 3.1.17 to 3.1.18

Updated by Vincent MEMBRÉ about 9 years ago Actions #23

  • Target version changed from 3.1.18 to 3.1.19

Updated by François ARMAND about 9 years ago Actions #24

  • 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

Updated by Vincent MEMBRÉ almost 9 years ago Actions #25

  • Target version changed from 3.1.19 to 3.1.20

Updated by Vincent MEMBRÉ almost 9 years ago Actions #26

  • Target version changed from 3.1.20 to 3.1.21

Updated by François ARMAND almost 9 years ago Actions #27

  • 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

Updated by Vincent MEMBRÉ almost 9 years ago Actions #28

  • Target version changed from 3.1.21 to 3.1.22

Updated by Benoît PECCATTE almost 9 years ago Actions #29

  • Priority changed from 21 to 34

Updated by Vincent MEMBRÉ over 8 years ago Actions #30

  • Target version changed from 3.1.22 to 3.1.23

Updated by Vincent MEMBRÉ over 8 years ago Actions #31

  • Target version changed from 3.1.23 to 3.1.24
  • Priority changed from 34 to 35

Updated by Vincent MEMBRÉ over 8 years ago Actions #32

  • Target version changed from 3.1.24 to 3.1.25

Updated by Vincent MEMBRÉ over 8 years ago Actions #33

  • Target version changed from 3.1.25 to 387

Updated by Vincent MEMBRÉ over 8 years ago Actions #34

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

Updated by Vincent MEMBRÉ about 8 years ago Actions #35

  • Target version changed from 4.1.10 to 4.1.11

Updated by Vincent MEMBRÉ almost 8 years ago Actions #36

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

Updated by Vincent MEMBRÉ almost 8 years ago Actions #37

  • Target version changed from 4.1.12 to 4.1.13

Updated by Vincent MEMBRÉ almost 8 years ago Actions #38

  • Target version changed from 4.1.13 to 4.1.14
  • Priority changed from 37 to 38

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

  • Target version changed from 4.1.14 to 4.1.15

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

  • Target version changed from 4.1.15 to 4.1.16

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

  • Target version changed from 4.1.16 to 4.1.17
  • Priority changed from 38 to 39

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

  • Target version changed from 4.1.17 to 4.1.18

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

  • Target version changed from 4.1.18 to 4.1.19

Updated by Alexis Mousset about 7 years ago Actions #44

  • Target version changed from 4.1.19 to 4.1.20

Updated by Alexis Mousset almost 7 years ago Actions #45

  • Target version changed from 4.1.20 to 588
  • Priority changed from 39 to 41

Updated by Nicolas CHARLES almost 7 years ago Actions #46

  • 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

Updated by Nicolas CHARLES almost 7 years ago Actions #47

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

Updated by Vincent MEMBRÉ over 6 years ago Actions #48

  • Target version changed from 5.0.13 to 5.0.14

Updated by Vincent MEMBRÉ over 6 years ago Actions #49

  • Target version changed from 5.0.14 to 5.0.15

Updated by François ARMAND over 6 years ago Actions #50

  • 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)

Updated by François ARMAND over 6 years ago Actions #51

  • 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: PDF Atom