Details
Description
Variables starting with underscore are still supposed to be valid with the future parser, but interpolation of them doesn't work if they're accessed using their qualified variable name.
eg
$ cat leading_underscore.pp
|
class bar ($foo) {
|
$_foo = $foo
|
notify {"Name of resource ${bar::_foo}":
|
message => 'something witty here'
|
}
|
}
|
class {'bar':
|
foo => 'one',
|
}
|
$ puppet apply --parser=future leading_underscore.pp
|
Error: Could not parse for environment production: Illegal fully qualified name in file /home/alex/github/test/leading_underscore.pp at line 3:36 on node alex-virtualbox.example.com
|
Error: Could not parse for environment production: Illegal fully qualified name in file /home/alex/github/test/leading_underscore.pp at line 3:36 on node alex-virtualbox.example.com
|
I discussed this on IRC and richard came up with the following example that probably demonstrates the issue more clearly than mine.
$ cat leading_underscore.pp
|
class bar {
|
$_foo = "one"
|
}
|
|
include bar
|
notice("${bar::_foo}")
|
|
$ puppet apply --parser=future leading_underscore.pp
|
Error: Could not parse for environment production: Illegal fully qualified name in file /Users/richardc/src/leading_underscore.pp at line 10:18 on node socks.local
|
Error: Could not parse for environment production: Illegal fully qualified name in file /Users/richardc/src/leading_underscore.pp at line 10:18 on node socks.local
|
|
$ cat leading_underscoreworking.pp
|
class bar {
|
$_foo = "one"
|
}
|
|
include bar
|
notice($bar::_foo)
|
|
$ puppet apply --parser=future leading_underscoreworking.pp
|
Notice: Scope(Class[main]): one
|
Notice: Compiled catalog for socks.local in environment production in 0.51 seconds
|
Notice: Finished catalog run in 0.03 seconds
|
Thanks,
Alex
risk assessment: medium (FR only for now)
probability: low (variables starting with underscores)
severity: medium (work arounds exist)
test layer: unit (https://github.com/puppetlabs/puppet/blob/dda2430457cd06c3381f02163dc9c15925b4bff7/spec/unit/pops/parser/lexer2_spec.rb#L230-L236)