Hi everyone, I have a quick question for everybody, does the class inheritance work for realizing ressource? Because I have the following class: # user_system.pp # # Realize the system users class user::user_system inherits user::virtual { # Realize system members Group <| tag == ''user_system'' |> -> User <| tag == ''user_system'' |> } And the class: # unixadmins.pp # # Realize the members of the Unix team and include any contractors class user::user_sysadmin inherits user::user_system { # Realize our team members Group <| tag == ''user_sysadmin'' |> -> User <| tag =''user_sysadmin'' |> } each time a node uses the class ''user::user_sysadmin'' the realisation of the class ''user::user_system'' doesn''t work, did I misunderstand the class inheritance? Regards, JM -- 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.
On Jan 5, 12:25 pm, Antidot SAS <antidot...@gmail.com> wrote:> Hi everyone, > > I have a quick question for everybody, does the class inheritance work for > realizing ressource? > > Because I have the following class: > # user_system.pp > # > # Realize the system users > > class user::user_system inherits user::virtual { > # Realize system members > Group <| tag == ''user_system'' |> -> User <| tag == ''user_system'' |> > > } > > And the class: > # unixadmins.pp > # > # Realize the members of the Unix team and include any contractors > > class user::user_sysadmin inherits user::user_system { > # Realize our team members > Group <| tag == ''user_sysadmin'' |> -> User <| tag => ''user_sysadmin'' |> > > } > > each time a node uses the class ''user::user_sysadmin'' the realisation of > the class ''user::user_system'' doesn''t work, did I misunderstand the class > inheritance?I think you understood correctly, to a point. Given the classes you specified, if your manifest includes class user::user_sysadmin then I would expect both Group collections and both User collections to be realized, with dependencies set up per the chaining operators you used. You didn''t say how you determined that this was not happening, and without knowing the contents of class user::virtual I cannot venture a guess. HOWEVER, what you have shown is not an appropriate use case for class inheritance. Inheritance can get the job done here (or should be able to do), but it should be reserved for cases where the subclass overrides properties of a superclass''s resources. Otherwise, it works as well or better, and is more flexible, to ''include'' the erstwhile parent class instead of inheriting from it: class user::user_system { include ''user::virtual '' Group <| tag == ''user_system'' |> -> User <| tag =''user_system'' |> } class user::user_sysadmin { include ''user::user_system'' Group <| tag == ''user_sysadmin'' |> -> User <| tag =''user_sysadmin'' |> } It is possible that rewriting your classes that way will solve the problem, but I can hardly be confident without understanding the nature of the problem in the first place. 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
I found out what was the problem: a group wasn''t declared right. But you point out a acknowledge that I misunderstand the class inheritance is just to change the defaut attributs not to be executed before, thx for reminding me this. Le 6 janv. 2012 15:22, "jcbollinger" <John.Bollinger@stjude.org> a écrit :> > > On Jan 5, 12:25 pm, Antidot SAS <antidot...@gmail.com> wrote: > > Hi everyone, > > > > I have a quick question for everybody, does the class inheritance work > for > > realizing ressource? > > > > Because I have the following class: > > # user_system.pp > > # > > # Realize the system users > > > > class user::user_system inherits user::virtual { > > # Realize system members > > Group <| tag == ''user_system'' |> -> User <| tag == ''user_system'' > |> > > > > } > > > > And the class: > > # unixadmins.pp > > # > > # Realize the members of the Unix team and include any contractors > > > > class user::user_sysadmin inherits user::user_system { > > # Realize our team members > > Group <| tag == ''user_sysadmin'' |> -> User <| tag => > ''user_sysadmin'' |> > > > > } > > > > each time a node uses the class ''user::user_sysadmin'' the realisation of > > the class ''user::user_system'' doesn''t work, did I misunderstand the class > > inheritance? > > > I think you understood correctly, to a point. Given the classes you > specified, if your manifest includes class user::user_sysadmin then I > would expect both Group collections and both User collections to be > realized, with dependencies set up per the chaining operators you > used. You didn''t say how you determined that this was not happening, > and without knowing the contents of class user::virtual I cannot > venture a guess. > > HOWEVER, what you have shown is not an appropriate use case for class > inheritance. Inheritance can get the job done here (or should be able > to do), but it should be reserved for cases where the subclass > overrides properties of a superclass''s resources. Otherwise, it works > as well or better, and is more flexible, to ''include'' the erstwhile > parent class instead of inheriting from it: > > class user::user_system { > include ''user::virtual '' > Group <| tag == ''user_system'' |> -> User <| tag => ''user_system'' |> > } > > class user::user_sysadmin { > include ''user::user_system'' > Group <| tag == ''user_sysadmin'' |> -> User <| tag => ''user_sysadmin'' |> > } > > It is possible that rewriting your classes that way will solve the > problem, but I can hardly be confident without understanding the > nature of the problem in the first place. > > > 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+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > >-- 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.
Could you post the final solution ? I am interested to see the proper way of doing this. Thanks. “Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.” Bill Waterson (Calvin & Hobbes) ----- Antidot SAS <antidotsas@gmail.com> wrote:> I found out what was the problem: a group wasn''t declared right. But you > point out a acknowledge that I misunderstand the class inheritance is just > to change the defaut attributs not to be executed before, thx for reminding > me this. > Le 6 janv. 2012 15:22, "jcbollinger" <John.Bollinger@stjude.org> a écrit : > > > > > > > On Jan 5, 12:25 pm, Antidot SAS <antidot...@gmail.com> wrote: > > > Hi everyone, > > > > > > I have a quick question for everybody, does the class inheritance work > > for > > > realizing ressource? > > > > > > Because I have the following class: > > > # user_system.pp > > > # > > > # Realize the system users > > > > > > class user::user_system inherits user::virtual { > > > # Realize system members > > > Group <| tag == ''user_system'' |> -> User <| tag == ''user_system'' > > |> > > > > > > } > > > > > > And the class: > > > # unixadmins.pp > > > # > > > # Realize the members of the Unix team and include any contractors > > > > > > class user::user_sysadmin inherits user::user_system { > > > # Realize our team members > > > Group <| tag == ''user_sysadmin'' |> -> User <| tag => > > ''user_sysadmin'' |> > > > > > > } > > > > > > each time a node uses the class ''user::user_sysadmin'' the realisation of > > > the class ''user::user_system'' doesn''t work, did I misunderstand the class > > > inheritance? > > > > > > I think you understood correctly, to a point. Given the classes you > > specified, if your manifest includes class user::user_sysadmin then I > > would expect both Group collections and both User collections to be > > realized, with dependencies set up per the chaining operators you > > used. You didn''t say how you determined that this was not happening, > > and without knowing the contents of class user::virtual I cannot > > venture a guess. > > > > HOWEVER, what you have shown is not an appropriate use case for class > > inheritance. Inheritance can get the job done here (or should be able > > to do), but it should be reserved for cases where the subclass > > overrides properties of a superclass''s resources. Otherwise, it works > > as well or better, and is more flexible, to ''include'' the erstwhile > > parent class instead of inheriting from it: > > > > class user::user_system { > > include ''user::virtual '' > > Group <| tag == ''user_system'' |> -> User <| tag => > ''user_system'' |> > > } > > > > class user::user_sysadmin { > > include ''user::user_system'' > > Group <| tag == ''user_sysadmin'' |> -> User <| tag => > ''user_sysadmin'' |> > > } > > > > It is possible that rewriting your classes that way will solve the > > problem, but I can hardly be confident without understanding the > > nature of the problem in the first place. > > > > > > 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+unsubscribe@googlegroups.com. > > For more options, visit this group at > > http://groups.google.com/group/puppet-users?hl=en. > > > > > > -- > 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. >-- 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.
HI everyone, Finally Dan, my inheritance was not working because there was a depency problem that''s why my realization was not working right. Now regarding the final solution the same schema is applied: Because I have the following class: # user_system.pp # # Realize the system users class user::user_system inherits user::virtual { # Realize system members Group <| tag == ''user_system'' |> -> User <| tag == ''user_system'' |> } And the class: # unixadmins.pp # # Realize the members of the Unix team and include any contractors class user::user_sysadmin inherits user::user_system { # Realize our team members Group <| tag == ''user_sysadmin'' |> -> User <| tag =''user_sysadmin'' |> } But apparently was more thinking class heritance as pre-required but this seems to be the wrong understanding of the concept and the use of class inheritance as to be used only to redefined ressource or add some; at least that''s what I have understand from John''s messages: "it should be reserved for cases where the subclass overrides properties of a superclass''s resources" On Fri, Jan 6, 2012 at 6:42 PM, Dan White <ygor@comcast.net> wrote:> Could you post the final solution ? > I am interested to see the proper way of doing this. > > Thanks. > > “Sometimes I think the surest sign that intelligent life exists elsewhere > in the universe is that none of it has tried to contact us.” > Bill Waterson (Calvin & Hobbes) > > ----- Antidot SAS <antidotsas@gmail.com> wrote: > > I found out what was the problem: a group wasn''t declared right. But you > > point out a acknowledge that I misunderstand the class inheritance is > just > > to change the defaut attributs not to be executed before, thx for > reminding > > me this. > > Le 6 janv. 2012 15:22, "jcbollinger" <John.Bollinger@stjude.org> a > écrit : > > > > > > > > > > > On Jan 5, 12:25 pm, Antidot SAS <antidot...@gmail.com> wrote: > > > > Hi everyone, > > > > > > > > I have a quick question for everybody, does the class inheritance > work > > > for > > > > realizing ressource? > > > > > > > > Because I have the following class: > > > > # user_system.pp > > > > # > > > > # Realize the system users > > > > > > > > class user::user_system inherits user::virtual { > > > > # Realize system members > > > > Group <| tag == ''user_system'' |> -> User <| tag => ''user_system'' > > > |> > > > > > > > > } > > > > > > > > And the class: > > > > # unixadmins.pp > > > > # > > > > # Realize the members of the Unix team and include any contractors > > > > > > > > class user::user_sysadmin inherits user::user_system { > > > > # Realize our team members > > > > Group <| tag == ''user_sysadmin'' |> -> User <| tag => > > > ''user_sysadmin'' |> > > > > > > > > } > > > > > > > > each time a node uses the class ''user::user_sysadmin'' the > realisation of > > > > the class ''user::user_system'' doesn''t work, did I misunderstand the > class > > > > inheritance? > > > > > > > > > I think you understood correctly, to a point. Given the classes you > > > specified, if your manifest includes class user::user_sysadmin then I > > > would expect both Group collections and both User collections to be > > > realized, with dependencies set up per the chaining operators you > > > used. You didn''t say how you determined that this was not happening, > > > and without knowing the contents of class user::virtual I cannot > > > venture a guess. > > > > > > HOWEVER, what you have shown is not an appropriate use case for class > > > inheritance. Inheritance can get the job done here (or should be able > > > to do), but it should be reserved for cases where the subclass > > > overrides properties of a superclass''s resources. Otherwise, it works > > > as well or better, and is more flexible, to ''include'' the erstwhile > > > parent class instead of inheriting from it: > > > > > > class user::user_system { > > > include ''user::virtual '' > > > Group <| tag == ''user_system'' |> -> User <| tag => > > ''user_system'' |> > > > } > > > > > > class user::user_sysadmin { > > > include ''user::user_system'' > > > Group <| tag == ''user_sysadmin'' |> -> User <| tag => > > ''user_sysadmin'' |> > > > } > > > > > > It is possible that rewriting your classes that way will solve the > > > problem, but I can hardly be confident without understanding the > > > nature of the problem in the first place. > > > > > > > > > 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+unsubscribe@googlegroups.com. > > > For more options, visit this group at > > > http://groups.google.com/group/puppet-users?hl=en. > > > > > > > > > > -- > > 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. > > > > -- > 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. > >-- 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.
On Jan 9, 10:21 am, Antidot SAS <antidot...@gmail.com> wrote:> But apparently was more thinking class heritance as pre-required but this > seems to be the wrong understanding of the concept and the use of class > inheritance as to be used only to redefined ressource or add some; at least > that''s what I have understand from John''s messages: "it should be reserved > for cases where the subclass overrides properties of a superclass''s > resources"To be clear: that''s a best practices position, not a hard requirement. 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+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.