think about lookup() function with $config
Hash $config is one parameter. And so the normal way of life in Puppet world to find the value of a parameter is :
- search in the hiera hierarchy
- find a value
- transmit this value to Puppet in code that call the class.
But if the user does not use Hiera, or use Hiera but provide a value for the parameter in Puppet code, this value is used. And what Hiera found it is not.
So with the
Hash $config it could be frustrating if we have to provide all the list of keys, just because we want to use just only one key with value different of the defaults.
In general, it is preferred to keep Puppet/Hiera working in normal way. But, here we have to consider usage of the Puppet function
lookup() that permit to enforce usage of Hiera resolution inside a peace of Puppet code.
Using this function means :
- we have to set all keys as
Optionalin the custom data type
- we have to let the user to know what is mandatory, instead of using the power of data type.