On Wed, Nov 16, 2016 at 10:42 AM, Albert Shih <albert.s...@obspm.fr> wrote:
> Le 16/11/2016 à 10:34:36+0100, Craig Dunn a écrit > > > # Tomcat class has an attribute called "catalina_home" which is looked > up from > > hiera data binding.... > > include ::tomcat > > > > class { "my_application": > > tomcat_root => $::tomcat::catalina_home > > } > > SUPER nice..... > > I didn't think about that.... > > Don't know why but I always thought that was « bad practice » to access > some attribute from outside the module. > Not at all - especially not when done from the profiles. A module's attributes are effectively it's API - by accessing $::tomcat::catalina_home you don't need to know or care if the value is being set by hiera or by the modules default (params.pp), and it's the best source of truth for that value. This is a very good example of the benefits of profiles too. Craig -- Enviatics | Automation and Configuration Management Puppet Labs Service Delivery Partner & Certified Consultant http://www.enviatics.com | @Enviatics | cr...@enviatics.com -- 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/CACxdKhE86B%3D0x7efpzEfAcmt6i_bL6yzjxWOyCHB9xMU0LZMeQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.