No, there is no option or setting that modulates this behavior. It has always worked that way, from the time automated data binding was introduced in Puppet 3, and it has always been the intended (and IMO sensible) behavior.
I speculate that you've confused the semantics of class definitions with those of resource-like class declarations. What you presented is the skeleton of a class definition, and a simple completion of it might be
notify { 'foo::bar params':
msg => "param1 = ${param1}, param2 = ${param2}"
}
}
That simply defines what class foo::bar means. It is roughly analogous to a function or method definition in many general-purpose programming languages.
The corresponding analogue of a function call, on the other hand, is a class declaration. There are two kinds, "include-like" and "resource-like". The first is performed via an include, require, or contain statement, and does not provide a means to express class parameter values in the manifest. For example,
That is preferable in many contexts, but it is also possible to declare classes as if "class" were a resource type:
class { 'foo::bar ':
# Parameter and metaparameter bindings may appear here, such as:
param1 => 42
}
Either way, every class parameter must be bound to a value. Puppet determines each parameter's value by checking the following sources, in order:
- The value specified in a resource-like class declaration has highest precedence if such a value exists. This is what I suspect you had in mind.
- The Puppet data lookup facility (a generalization of Hiera)
- The default value provided by the class definition, if any.
The first source from which a value for the parameter can be obtained is used, and if none of those provides a value then the catalog builder bails. Thus, if you want a value from Hiera to be used for parameter
$foo::bar::param2 then in addition to providing such a value in the data, you must ensure that any resource-like declaration of the class that is evaluated avoids binding a value to that parameter. And this is the same thing I was saying in my earlier response.
John