Open XnS opened 4 years ago
Hi @XnS,
yeah, this seems to happen because of node
being treated as a special keyword by puppet-lint. Actually, I'm seeing the same error with your second code example.
There is a list of those keywords defined in lexer.rb: https://github.com/rodjek/puppet-lint/blob/a9654aebf6/lib/puppet-lint/lexer.rb#L58-L80.
During tokenising all tokens of type :NAME that are part of the list are not tokenized as names but as the particular keyword: https://github.com/rodjek/puppet-lint/blob/a9654aebf6/lib/puppet-lint/lexer.rb#L213-L217
In your case the line with node => $db_node
is tokenised as
Token :INDENT ( )
Token :NODE (node)
Token :WHITESPACE ( )
Token :FARROW (=>)
Token :WHITESPACE ( )
Token :VARIABLE (db_node)
Token :NEWLINE (
)
Non-special parameter names would result in the second token being of type :NAME
instead:
Token :NAME (authentication)
The actual error comes from the check unquoted_node_name
. It searches for an opening curly brace after the :NODE token and doesn't find one: https://github.com/rodjek/puppet-lint/blob/a9654aebf6/lib/puppet-lint/plugins/check_nodes/unquoted_node_name.rb#L11
So a quick workaround would be to disable that check. (I'm afraid it's not possible to use inline comments to disable the check only for the code in question, since these comments don't prevent the syntax error from happening.)
Looking at Puppet's documentation for reserved words node
is listed there, but as far as I understand, it is allowed as a parameter name. (Parameter names doesn't seem to be counted as bare word strings
.)
I don't see an easy way to make puppet-lint accept reserved words as parameter names. @rodjek could give you more insights on this.
Hi,
we use the module
crayfishx/db2
to setup db2 installation on our hosts. If we try to to use one particular type, puppet-lint fails withPuppet parser has no output:
The code
Line 63 is the
node => $db_node
partI suspected
node
to be a problem because it could be some kind of magic word, but the following code is validated without any error (node is actually not a valid parameter for this type):Does anyone have an idea why puppet-lint fails in this case?