On Fri, Mar 18, 2011 at 7:01 PM, Ashley Gould <[email protected]> wrote: > On Fri, Mar 18, 2011 at 11:15:56AM -0700, jcbollinger wrote: >> >> >> On Mar 17, 6:03 pm, Ashley Gould <[email protected]> wrote: >> > I'm hoping to avoid using subclasses, because there would have to >> > be oodles of them to accomodate the all the variations between nodes. >> > >> > node default { >> > class { sudoers: } >> > >> > } >> > >> > node 'sl11lab02' inherits default { >> > >> > # this runs but does nothing >> > Class[sudoers] { additional_rules => [ "$rules_uas" ] } >> > >> > # this errors with "Cannot assign to variables in other namespaces" >> > #$sudoers::additional_rules = [ "$rules_uas" ] >> > >> > # this errors with "Class[Sudoers] is already defined" >> > #class { sudoers: additional_rules => [ "$rules_uas" ] } >> > >> > } >> >> Node inheritance is not the same as class inheritance. Only the >> latter allows you to override resource properties, and I'm not sure >> whether even that allows you to override class parameters. I had >> thought not. >> >> If you have many nodes with various small differences between them, >> then perhaps it's time to look into an external node classifier. >> Alternatively, make your classes smarter: instead of parameterizing >> them, put the erstwhile parameter-selection logic inside them. > > > You touched the heart of the matter: Is there a way to override > class parameters?
No. Once you've declared a class, you can't declare it again with different parameters. In fact, you can't declare it again at all. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
