The following would work:

node default {
    class { sudoers: }
}

node 'sl11lab02' {
    class { sudoers: additional_rules => [ "$rules_uas" ] }
}


On Mar 18, 12:03 am, Ashley Gould <ago...@ucop.edu> wrote:
> I am exploring usage of parameterized classes.  I hit a wall when
> trying to override values of parameters in a node definition that
> inherits the class from a parent node.  Is there a way to do this,
> or must I include the class only in the child node?
>
> 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" ] }
>
> }
>
> class sudoers (
>     $default_rules    = "$rules_unixgroup",
>     $additional_rules = [ "" ]
>     ) {
>
>     file { "/tmp/sudoers":
>         owner   => root, group => root, mode => 440,
>         content => template("sudoers/sudoers.erb"),
>         notify  => Exec["check-sudoers"],
>     }
>
>     exec { "check-sudoers":
>         command => "/usr/sbin/visudo -cf /tmp/sudoers && cp /tmp/sudoers 
> /etc/sudoers",
>         refreshonly => true,
>     }
>
> }
>
> --
>
> -ashley
>
> Did you try poking at it with a stick?

-- 
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.

Reply via email to