Details
-
Bug
-
Status: Closed
-
Critical
-
Resolution: Fixed
-
PUP 4.6.0
-
None
-
1
-
Language 2016-08-24
-
Bug Fix
-
Description
Variables defined in a class are not in scope after resource-like declaration of that class:
$ cat test.pp
|
class a($myvar = 'hello') {}
|
class { 'a': myvar => 'goodbye' }
|
notify { $a::myvar: }
|
|
$ puppet --version
|
4.5.3
|
$ puppet apply --strict_variables test.pp
|
Notice: Compiled catalog for kvm-01.node.vagrant.consul in environment production in 0.03 seconds
|
Notice: goodbye
|
Notice: /Stage[main]/Main/Notify[goodbye]/message: defined 'message' as 'goodbye'
|
Notice: Applied catalog in 0.02 seconds
|
|
$ puppet --version
|
4.6.0
|
$ puppet apply --strict_variables test.pp
|
Error: Evaluation Error: Unknown variable: 'a::myvar'. at /home/vagrant/test.pp:3:10 on node kvm-01.node.vagrant.consul
|
Without strict_variables it could be very dangerous. Note that if you add an include, it works:
$ cat test.pp
|
class a($myvar = 'hello') {}
|
class { 'a': myvar => 'goodbye' }
|
include a
|
notify { $a::myvar: }
|
|
$ puppet --version
|
4.6.0
|
$ puppet apply --strict_variables test.pp
|
Notice: Compiled catalog for kvm-01.node.vagrant.consul in environment production in 0.09 seconds
|
Notice: goodbye
|
Notice: /Stage[main]/Main/Notify[goodbye]/message: defined 'message' as 'goodbye'
|
Notice: Applied catalog in 0.02 seconds
|
Attachments
Issue Links
- is duplicated by
-
MODULES-3750 puppetlabs-apache module fails with puppet-agent 1.6.0 on Puppetmaster
-
- Closed
-
- links to
- mentioned in
-
Page Loading...