Hi all, I have a site.pp which defines the user I want to log in as, however on some nodes (depending on which software is installed) this user needs to be a member of particular groups. If I define the user in site.pp with core details and then in each class alter the group membership (the idea being including all the necessary classes will install the software, configure it, and make me a member of all the necessary groups) I get this error: Error 400 on SERVER: Duplicate definition: User[adam] is already defined in file ...; cannot redefine at ... Is there any way I can make the node definition "inherit" the site one? All I want to do is add another entry into the array passed as the ''groups'' parameter. Many thanks, Adam. -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Felix Frank
2010-Dec-29 12:45 UTC
Re: [Puppet Users] How do you extend a previous setting?
On 12/29/2010 01:26 PM, Adam Nielsen wrote:> Hi all, > > I have a site.pp which defines the user I want to log in as, however on > some nodes (depending on which software is installed) this user needs to > be a member of particular groups. > > If I define the user in site.pp with core details and then in each class > alter the group membership (the idea being including all the necessary > classes will install the software, configure it, and make me a member of > all the necessary groups) I get this error: > > Error 400 on SERVER: Duplicate definition: User[adam] is already defined > in file ...; cannot redefine at ... > > Is there any way I can make the node definition "inherit" the site one? > All I want to do is add another entry into the array passed as the > ''groups'' parameter.Good keyword that. Put the use definition in a class. Each list of groups is a subclass such that class my_user_in_group_foo inherits my_user { User["bla"] { groups +> [ "foo", "bar" ] } } Include those subclasses as appropriate. HTH, Felix -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Adam Nielsen
2010-Dec-29 12:52 UTC
Re: [Puppet Users] How do you extend a previous setting?
>> Is there any way I can make the node definition "inherit" the site one? >> All I want to do is add another entry into the array passed as the >> ''groups'' parameter. > > Good keyword that. > > Put the use definition in a class. Each list of groups is a subclass > such that > > class my_user_in_group_foo inherits my_user { > User["bla"] { groups +> [ "foo", "bar" ] } > } > > Include those subclasses as appropriate.Ah, of course! I''m still new to Puppet and had forgotten about class inheritance. I just tried this and it works perfectly. Many thanks! Adam. -- 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.