luke.bigum
2011-Feb-14 12:14 UTC
[Puppet Users] fork from Collection and Realizing resources (puppet-dev)
Hi list (specifically Dan), I was interested in the snippet you provided in the recent thread "Collection and Realizing resources" and how it could be used to safely include both ''app'' and ''db'' class without causing a conflict in the user ''bob''. I can''t quite see how that''s possible, even using class inheritance and the plusignment operator, you''d run into trouble overriding the same resource twice (bob). How does the collection syntax help? Quoting Dan: We have only been teaching <| |> in the puppetmaster training as a way to realize virtual resources. We do not teach that it is possible to override attributes with this syntax as well: <| |> {} (at least in part b/c the implications/non-determinism terrify me) , and do not teach that it actually effects all resources. The common example from class is something like: class db::users { user { [''alice'', ''bob'']: ensure => present, gid => ''dbadmin'', } } class app::users { user { [''charlie'', ''bob'']: ensure => present, gid => ''webadmin'', } } class app { User<| gid == ''webadmin'' |> ... } class db { User<| gid == ''dbadmin'' |> ... } so that a machine can safely be a webserver and db server without conflict. -- 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.
Dan Bode
2011-Feb-14 23:40 UTC
Re: [Puppet Users] fork from Collection and Realizing resources (puppet-dev)
On Mon, Feb 14, 2011 at 4:14 AM, luke.bigum <luke.bigum@fasthosts.co.uk>wrote:> Hi list (specifically Dan), > > I was interested in the snippet you provided in the recent thread > "Collection and Realizing resources" and how it could be used to > safely include both ''app'' and ''db'' class without causing a conflict in > the user ''bob''. I can''t quite see how that''s possible, even using > class inheritance and the plusignment operator, you''d run into trouble > overriding the same resource twice (bob). How does the collection > syntax help? >ah, those resources should have been virtual:> Quoting Dan: > > We have only been teaching <| |> in the puppetmaster training as a way > to > realize virtual resources. We do not teach that it is possible to > override > attributes with this syntax as well: <| |> {} (at least in part b/c > the > implications/non-determinism terrify me) , and do not teach that it > actually > effects all resources. > > The common example from class is something like: > > class db::users { >should be @user { [''alice'', ''bob'']:> user { [''alice'', ''bob'']: > ensure => present, > gid => ''dbadmin'', > } > > } > > class app::users { >should be @user { [''charlie'', ''bob'']:> user { [''charlie'', ''bob'']: > ensure => present, > gid => ''webadmin'', > } > > } > > class app { > User<| gid == ''webadmin'' |> > ... > > } > > class db { > User<| gid == ''dbadmin'' |> > ... > > } > > also missing:include app::users, db::users, db, app> so that a machine can safely be a webserver and db server without > conflict. > > -- > 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.