On Feb 20, 10:24 am, Jos Houtman <j...@hyves.nl> wrote: > Hi group, > > I expect parameterized classes to behave simular to types in relation > to overrides, but obviously this is not the case. > Could someone what is should then expect from overriding an parameterized > class. > > what I have is: > > class dns(dns_servers) { > file{'/etc/resolv.conf': > content => template("dns/resolv.conf.erb") > } > > } > > class role::init { > class{'dns': > dns_servers => ['10.100.100.1'] > } > > } > > class role::loadbalancer inherits role { > Class['dns'] { > dns_servers => ['127.0.0.1'] > } > > } > > node loadbalancer1 { > include role::loadbalancer > > } > > I expected resolv.conf to have the 127.0.0.1 address, but it has the > 10.100.100.1 address. > > Could someone explain to me the rules around parameterized class inheritence.
Parameterized class inheritance is just like non-parameterized class inheritance. In fact, it is *exactly* like non-parameterized class inheritance, including that it provides no mechanism for the parameters of the superclass to be set when the subclass is declared. > And if using inheritence to override general use cases for very common > modules is not the way, should all this logic then be put into our > extlookup or something like hiera? My recommendation is to use hiera for all the needs you may now be addressing via class parameters. You may find that that also reduces your interest in class inheritence, but if you still want to use some inheritence then you won't need to deal with parameterized base classes. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.