Actions
Bug #5283
closedUnhelpful feedback with special string template characters
Pull Request:
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) [...]
Actions