I thought the purpose of classes was that you could redefine types in the subclasses. However I get "Duplicate definition" errors whenever I attempt this. On a whim I tried the code from the documentation: http://reductivelabs.com/projects/puppet/documentation/structures.html --- Subclassing The primary benefit of using subclasses instead of just including the parent class is that the subclass can override elements in the parent class: class unix { file { "/etc/sudoers": owner => root, group => root, mode => 440 } } class bsd inherits unix { file { "/etc/sudoers": group => wheel } } Including the unix class sets the group to root, but including the bsd class overrides the vale to wheel. --- This was the result from a node that included bsd: Duplicate definition: file[/etc/sudoers] is already defined in file /etc/puppet/manifests/test.pp at line 6; cannot redefine in file /etc/puppet/manifests/test.pp at line 12 This is using puppet 0.20.1-1 from debian etch. Can someone explain if I''m missing something. Thanks.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Sunday 14 January 2007 00:39, Jesse Johnson wrote:> I thought the purpose of classes was that you could redefine types in > the subclasses. However I get "Duplicate definition" errors whenever I > attempt this. On a whim I tried the code from the documentation: > > http://reductivelabs.com/projects/puppet/documentation/structures.html > > --- > Subclassing > > The primary benefit of using subclasses instead of just including the > parent class is that the subclass can override elements in the parent > class: > > class unix { > file { "/etc/sudoers": > owner => root, > group => root, > mode => 440 > } > } > > class bsd inherits unix { > file { "/etc/sudoers": > group => wheel > } > } > > Including the unix class sets the group to root, but including the bsd > class overrides the vale to wheel.Hmm, this seems to be a error in the documentation. Current puppet versions require a different syntax for overriding: class bsd inherits unix { File["/etc/sudoers"] { group => wheel } } Regards, David - -- - - hallo... wie gehts heute? - - *hust* gut *rotz* *keuch* - - gott sei dank kommunizieren wir über ein septisches medium ;) -- Matthias Leeb, Uni f. angewandte Kunst, 2005-02-15 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFFqYub/Pp1N6Uzh0URAsYyAJ9L6hD83l769x6QMdhxv+ZP+glIzQCff+Br u4AVxY8kHXSCySAe4NXyArs=IGg2 -----END PGP SIGNATURE-----
On 1/13/07, David Schmitt <david@schmitt.edv-bus.at> wrote:> Hmm, this seems to be a error in the documentation. Current puppet versions > require a different syntax for overriding: > > class bsd inherits unix { > File["/etc/sudoers"] { group => wheel } > } > > Regards, DavidYeah, here it indicates that overriding-by-redefining works: https://reductivelabs.com/cgi-bin/puppet.cgi/wiki/LanguageStructures That''s why I had this same issue :) -Charlie
On Jan 19, 2007, at 10:28 AM, Charlie Schluting wrote:> Yeah, here it indicates that overriding-by-redefining works: > https://reductivelabs.com/cgi-bin/puppet.cgi/wiki/LanguageStructures > > That''s why I had this same issue :)Fortunately Christian Warden has fixed this. Sorry I let it sit there wrong for so long. -- I also realize I can no longer spell "pseudo". My fingers have now hard-wired "sudo". Thanks, Unix! I also cannot uppercase "cat" for the life of me. --Jonathan Rentzsch --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com