Hey Guys, I was experimenting with puppet lang ( as in just learning ), found something like below happening, i couldn''t explain it to myself so thought asking here. I have installed puppet 2.6.7 using rubygems. here''s the manifest: ===$ cat 7.stage_run_example.pp stage {"first": before => Stage[main]} stage {"last": require => Stage[main]} class { "unix": stage => first; "apache": stage => main; "praddy": stage => last; } class unix { notify{"unix": message => "this is a unix class"} } class apache inherits unix { notify{"apache": message => "this is an apache class"} } class praddy inherits apache { Notify["apache"] { message => "this is overridden" } notify {"praddy": message => "this is a praddy class" } } class param_notify ($message="default message") { notify{"$message":} } include unix /* the invocation below should emit "this is an apache class" message, but ???? */ include apache class {param_notify: message => "I am a parameterized class"} === And here''s the output that I get: ===$ puppet apply 7.stage_run_example.pp warning: Could not retrieve fact fqdn notice: this is a unix class notice: /Stage[first]/Unix/Notify[unix]/message: defined ''message'' as ''this is a unix class'' notice: I am a parameterized class notice: /Stage[main]/Param_notify/Notify[I am a parameterized class]/ message: defined ''message'' as ''I am a parameterized class'' notice: this is overridden notice: /Stage[main]/Apache/Notify[apache]/message: defined ''message'' as ''this is overridden'' notice: this is a praddy class notice: /Stage[last]/Praddy/Notify[praddy]/message: defined ''message'' as ''this is a praddy class'' notice: Finished catalog run in 0.03 seconds === So, when including the "apache" class i should not be getting the the message which is overridden in the "praddy" class, or am i interpreting it all wrong? puppet version: ===$ puppet -V 2.6.7 === - praddy -- 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, On 04/16/2011 11:56 PM, praddy wrote:> Hey Guys, > > I was experimenting with puppet lang ( as in just learning ), found > something like below happening, i couldn''t explain it to myself so > thought asking here. I have installed puppet 2.6.7 using rubygems. > > here''s the manifest: > > ===> $ cat 7.stage_run_example.pp > stage {"first": before => Stage[main]} > stage {"last": require => Stage[main]} > > class { > "unix": stage => first; > "apache": stage => main; > "praddy": stage => last; > } > > class unix { > notify{"unix": message => "this is a unix class"} > } > > class apache inherits unix { > notify{"apache": message => "this is an apache class"} > } > > class praddy inherits apache { > Notify["apache"] { message => "this is overridden" } > notify {"praddy": message => "this is a praddy class" } > } > > class param_notify ($message="default message") { > notify{"$message":} > }<snip>> So, when including the "apache" class i should not be getting the the > message which is overridden in the "praddy" class, or am i > interpreting it all wrong?Your idea of inheritance does not fit the puppet paradigm. Your "apache" class should not inherit "unix", it may want to include it (or depend on it, as multiple inclusion is currently not supported for parameterized classes). This is an example of inheritance in puppet: class apache { package { "apache2-mpm-prefork": ensure => installed } } class apache_worker inherits apache { Package["apache2-mpm-prefork"] { ensure => absent } package { "apache2-mpm-worker": ensure => installed, require => Package["apache2-mpm-prefork"], } } You inherit in class to override some of its resources (and possibly add some like a different package here), but not much more. Don''t try and build a hierarchy of inherited classes, puppet''s inheritance model is not meant for that (or fit for it). 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.