Puppet, Puppet-lint and linebreaks

There was an interesting error today regarding Puppet, puppet-lint and the puppet syntax checker.

While puppet-lint was complaining about a perfectly fine line, the puppet syntax checker did not show any problems.

Given was a code like this:

# === Class: rsyslog::client
#
#
# ...
class rsyslog::client (
  $var1 = '',
  $var2 = '',
  $var3 = '',
){

  package{'somepackage':
    ensure => installed,
  }
}

When checking the syntax and style with puppet-lint, the tool returned an error pointing to line 5:

$ puppet-lint rsyslog/manifest/client.pp
ERROR unknown says Syntax error (try running  puppet parser validate <file> ) for init.pp on line 5

Following the advise running puppet parser returned - well - nothing:

$ puppet parser validate rsyslog/manifest/client.pp
$

Changing the file, rewriting it and deleting parts of it, did not change anything.

What happened here? In this case the file I got was encode with the typical Windows line-break ^M. This triggered an error in puppet-lint, but got past the syntax check in puppet parser.

After replacing the line-breaks with dos2unix, I was able to see the change in GIT as well.

$ dos2unix rsyslog/manifest/client.pp
$

This will certainly be memorized for future occasions.