Yesterday, I switched our node structure from using node basenode, node nodetype inherits basenode, to using node classes per the changes discussed recently on this list and as defined in the wiki:GlossaryOfTerms. In the manifest, we have a syslog module which sets up all the components of syslog-ng we''re using. The ''syslog'' class is used by default on clients and then a syslog::server class is used on the central syslog servers. In the new node structure, I have the following defined: class syslog { # stuff under the syslog module. } class nodetype { include syslog # should be just the syslog client configuration. } class nodetype::syslog inherits nodetype { # stuff specific to the syslog servers, includes syslog::server for example } node "somehost" { include nodetype } Is the expected behaviour that when "somehost" includes nodetype, and nodetype includes a subclass with the same name as another parent class from a module (syslog), that nodetype will include nodetype::syslog instead of syslog from that module? Here''s an example log message from when this ran, to show the scope of the namespacing: notice: //vpn1a/nodetype/nodetype::syslog/syslog/File[/etc/syslog-ng.conf]/source: replacing from source puppet://puppet/syslog/syslog-ng.conf-server with contents {md5}147f c06a9948b94ec621431c94a92b2b Of course, node vpn1a includes nodetype::vpn, not nodetype::syslog. However, nodetype has ''include syslog'' as above, and ''nodetype'' is inherited by ''nodetype::vpn''. Should I file this as a bug?
On Dec 19, 2007, at 9:48 AM, Joshua Timberman wrote:> Is the expected behaviour that when "somehost" includes nodetype, and > nodetype includes a subclass with the same name as another parent > class from a module (syslog), that nodetype will include > nodetype::syslog instead of syslog from that module?Well, it''s the behaviour I would expect, so it''s the behaviour that I coded in. Naming lookups are always relative to the current class first. If you want the top-level class, use ::syslog.> Here''s an example log message from when this ran, to show the scope of > the namespacing: > > notice: //vpn1a/nodetype/nodetype::syslog/syslog/File[/etc/syslog- > ng.conf]/source: > replacing from source puppet://puppet/syslog/syslog-ng.conf-server > with contents {md5}147f > c06a9948b94ec621431c94a92b2b > > Of course, node vpn1a includes nodetype::vpn, not nodetype::syslog. > However, nodetype has ''include syslog'' as above, and ''nodetype'' is > inherited by ''nodetype::vpn''. Should I file this as a bug?This is the behaviour I chose, and I think anything else would be more confusing. Imagine this code: class syslog { ... } class nodetype { class syslog { ... } include syslog } Wouldn''t you expect that include to get the nodetype::syslog, rather than the top-level syslog? I certainly would, and this syntax is equivalent to specifying ''class nodetype::syslog''. -- The point of living and of being an optimist, is to be foolish enough to believe the best is yet to come. -- Peter Ustinov --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
On Dec 19, 2007 10:07 AM, Luke Kanies <luke@madstop.com> wrote:> Wouldn''t you expect that include to get the nodetype::syslog, rather > than the top-level syslog? I certainly would, and this syntax is > equivalent to specifying ''class nodetype::syslog''.Sure, that is sensible. My manifest is using nodetype::logserver now; no bug to see here, move along. -- Joshua Timberman