Greetings, I have read searched and read several threads in the list regarding using hiera, automatic lookup, and class params. Some of them, I'm thinking relate to Puppet3 and prior, and I admit I'm struggling a bit with weeding through the information that's appropriate to my scenario of versions. Please bear with me. I am attempting to build a module that will use Hiera data layers and get away from the params.pp pattern. The hope is that customers can use their environment hiera data if they choose, global data from an ENC, accept the default module layer data or use resource definition and supply data directly. Unfortunately the module is complex and has many sublcasses, the init.pp looks something like:
class complex ( Array $class_incl_list, Array $class_excl_list, Boolean $enable_feature1, ...more params that subclasses might use... ) { validate_array($class_incl_list) validate_array($class_excl_list) $local_incl_list = array_subtract($class_incl_list, $class_excl_list) include $local_incl_list } The class arrays are strings of fully qualified subclass names, e.g. [ 'complex::redhat::subclass1', 'complex::redhat::subclass2', ] etc. Is there a benefit to actually using class params or declaring all references to class variables directly as fully qualified in the subclasses? Here's a simplified example subclass, and yes the example is silly, if we enable/disable a feature in puppet code, why not just exclude the subclass altogether. Typically, that is what happens, but I was failing to find any other simplistic examples to provide. class complex::redhat::subclass1 ( Boolean $enable_feature1, ) { if $enable_feature1 { notify("${::osfamily} Feature 1 is enabled") } else { notify("${::osfamily} Feature 1 is disabled") } } Would I be better off removing the class param and using $::complex::enable_feature1 in the conditional? The subclasses aren't really meant to be called by the end-user directly, so I would never expect to see someone doing a resource declaration of a subclass, but I would expect to see a user doing a resource declaration of the main class and supplying the enable_feature1 boolean with it. Thanks for your thoughts and input. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/f374a512-e5a1-4933-bc0e-405bbc8b44f9%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.