Issue #19025 has been reported by Joshua Hoblitt.

----------------------------------------
Bug #19025: inconsistent behavior when using the value of one class parameter 
to initialize another
https://projects.puppetlabs.com/issues/19025

Author: Joshua Hoblitt
Status: Unreviewed
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 3.0.2
Keywords: 
Branch: 


The behaviour seen in the test1 and test2 cases below is highly surprising.  I 
feel that this should either work consistently or the class definition should 
fail to compile instead of magically instantiating an undef $y.

    $ puppet --version
    3.0.2
    $ cat test1.pp
    class x ($y = 1, $z = $y) {
    notify{"y = ${y}": }
    notify{"z = ${z}": }
    }
    include x
    $ puppet apply test1.pp
    Warning: Config file /home/jhoblitt/.puppet/hiera.yaml not found, using 
Hiera defaults
    Notice: z = 
    Notice: /Stage[main]/X/Notify[z = ]/message: defined 'message' as 'z = '
    Notice: y = 1
    Notice: /Stage[main]/X/Notify[y = 1]/message: defined 'message' as 'y = 1'
    Notice: Finished catalog run in 0.07 seconds
    [jhoblitt@nvo-test1 tests]$ cat test2.pp 
    class x ($y = 1, $z = $y) {
    notify{"y = ${y}": }
    notify{"z = ${z}": }
    }
    class{ 'x': }
    $ puppet apply test2.pp
    Warning: Config file /home/jhoblitt/.puppet/hiera.yaml not found, using 
Hiera defaults
    Notice: z = 
    Notice: /Stage[main]/X/Notify[z = ]/message: defined 'message' as 'z = '
    Notice: y = 1
    Notice: /Stage[main]/X/Notify[y = 1]/message: defined 'message' as 'y = 1'
    Notice: Finished catalog run in 0.12 seconds
    [jhoblitt@nvo-test1 tests]$ cat test3.pp 
    class x ($y = 1, $z = $y) {
    notify{"y = ${y}": }
    notify{"z = ${z}": }
    }
    class{ 'x': y => 2 }
    $ puppet apply test3.pp
    Warning: Config file /home/jhoblitt/.puppet/hiera.yaml not found, using 
Hiera defaults
    Notice: y = 2
    Notice: /Stage[main]/X/Notify[y = 2]/message: defined 'message' as 'y = 2'
    Notice: z = 2
    Notice: /Stage[main]/X/Notify[z = 2]/message: defined 'message' as 'z = 2'
    Notice: Finished catalog run in 0.08 seconds



-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to