The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

This issue tracker is now in read-only archive mode and automatic ticket export has been disabled. Redmine users will need to create a new JIRA account to file tickets using https://tickets.puppetlabs.com. See the following page for information on filing tickets with JIRA:

Bug #3695

Incoherent error message on ERB syntax error

Added by Carl Caum about 6 years ago. Updated over 2 years ago.

Status:AcceptedStart date:04/28/2010
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:error reporting
Target version:-
Affected Puppet version:0.25.4 Branch:
Keywords:

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com

This ticket is now tracked at: https://tickets.puppetlabs.com/browse/PUP-1345


Description

I have had the following ERB template with a syntax error on the first line (missing % for password variable):

test -z "<%= user %>" || export USER_PIECE="--username <%= user %> --password <%= password >" 
if svn info <%= destination %> 2> /dev/null; then 
svn -q --non-interactive $USER_PIECE up <%= destination %>; 
else
mkdir -p <%= destination %>; 
svn -q --non-interactive $USER_PIECE co <%= source %> <%= destination %>; 
fi;

This is the puppet output:

bash-3.2# puppetd --test
......
info: Loading facts in rm_privs
info: Loading facts in env_vars
err: Could not retrieve catalog from remote server: wrong header line format
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run

I think it would be helpful to have ERB compilation errors more coherent to make debugging easier.


Related issues

Related to Puppet - Bug #4845: unhelpful error message when config_version script fails Accepted 09/26/2010
Duplicated by Puppet - Bug #4005: Confusing error from bad template syntax Duplicate 06/15/2010

History

#1 Updated by James Turnbull about 6 years ago

  • Status changed from Unreviewed to Investigating
  • Assignee set to James Turnbull

#2 Updated by James Turnbull over 5 years ago

  • Category set to error reporting
  • Status changed from Investigating to Accepted
  • Assignee deleted (James Turnbull)

#3 Updated by Michael Halligan almost 5 years ago

  • Affected Puppet version changed from 0.25.4 to 2.7.1

2.7.1 is also affected.

#4 Updated by James Turnbull almost 5 years ago

  • Affected Puppet version changed from 2.7.1 to 0.25.4

Best to mark the earliest affected version.

#5 Updated by Nigel Kersten almost 5 years ago

This totally isn’t clear, but the Affected Puppet version is meant to indicate the earliest version we’ve observed it in, which is why we set it back.

Error reporting in general is an area we need improvement in and are targeting for the next release, particularly around passing errors from the master down to the agent.

The puppet master will report the errors because that’s where template evaluation is done, but it’s frustrating when you’re sitting at the agent.

Given how easy it is to introduce syntax errors in erb templates, best practice is to have validation on all your erb files in a pre-commit hook.

http://docs.puppetlabs.com/guides/templating.html#syntax-checking

#6 Updated by Michael Halligan almost 5 years ago

Nigel, my apologies for the confusion. How about at least a band-aid patch .. Amend that rather unhelpful error to say “It might be a problem with an ERB template” to at least give somebody a clue as to where they might begin debugging?

#7 Updated by Anonymous over 2 years ago

Redmine Issue #3695 has been migrated to JIRA:

https://tickets.puppetlabs.com/browse/PUP-1345

Also available in: Atom PDF