Details
Description
I'm not sure this if this is bug or not, but I wanted to get some feedback on a small test case that I wrote while researching Puppet variable data types. I have a params.pp and init.pp class as follows:
class vartest::params {
|
String $param1 = 'teststring'
|
}
|
class vartest (
|
String $param1 = $vartest::params::param1
|
) inherits vartest::params {
|
|
notice($param1)
|
}
|
I receive the following message when I invoke "puppet apply -e 'include vartest'":
Error: This Type-Name has no effect. A value was produced and then forgotten (one or more preceding expressions may have the wrong form) at /etc/puppetlabs/code/environments/production/modules/vartest/manifests/params.pp:2:3 on node sdp-exercise.vagrant
|
If I delete the String token from the variable assignment in init.pp, I receive the same message. If I restore that token and then remove the String token from the variable assignment in params.pp, I see the following output from puppet apply:
Notice: Scope(Class[Vartest]): teststring
|
Notice: Compiled catalog for sdp-exercise.vagrant in environment production in 0.15 seconds
|
Notice: Applied catalog in 0.01 seconds
|
I'm just wondering if those errors above are expected and why I can't use the String data type in both classes. It seems like that might be a useful language feature, especially when heavily refactoring code and wanting to make sure inherited variable data types still match what's expected.