bartavelle / language-puppet

A library to work with Puppet manifests, test them and eventually replace everything ruby.
BSD 3-Clause "New" or "Revised" License
51 stars 8 forks source link

Parsing fails with expression in selector #262

Closed PierreR closed 5 years ago

PierreR commented 5 years ago

Puppet doc: https://puppet.com/docs/puppet/5.3/lang_conditional.html#location

From https://github.com/pcfens/puppet-filebeat/blob/master/manifests/params.pp#L55

puppetresources --parse ./modules/filebeat/manifests/params.pp
ERROR: cannot parse ./modules/filebeat/manifests/params.pp:55:64:
   |
55 |       $major_version = versioncmp('6.3', $::kernelversion) < 0 ? {
   |                                                                ^
unexpected '?'
expecting "<=", ">=", '<', '>', '}', Statement, operator, or the rest of Statement

To fix it, you'd need to wrap with parens: $major_version = (versioncmp('6.3', $::kernelversion) < 0) ? {

PierreR commented 5 years ago

This is failing both in master and with 1.3.20.1

bartavelle commented 5 years ago

Does that help?

PierreR commented 5 years ago

Yep, seems to work nicely. Thanks !