Another iteration of failure is the following. This one is in the likeness of ::parms for a class, but if it nrpe:load inherits override class, then I can't declare the override class anywhere else. This was my first attempt to do this, and have tried 4 other iterations of this, but as far as I can tell, because it can't inherit the class, it will ONLY use the default values, which can only be undef or some other default value, again defeating the ability to override.
class nrpe::load { package { nagios-plugins-load: ensure => installed } if $nrpe::load::override::warn == 'UNSET' { $warn = $processorcount } else { $warn = $nrpe::load::override::warn } if $nrpe::load::override::crit == 'UNSET' { $crit = $processorcount * 2 } else { $crit = $nrpe::load::override::crit } file { "/etc/nagios/command.d/load.cfg": owner => root, group => root, mode => 640, content => template("nrpe/load.cfg.erb"), notify => Service[nrpe] } } class nrpe::load::override($warn = 'UNSET', $crit = 'UNSET') { } On Monday, September 24, 2012 12:47:31 PM UTC-4, George Shammas wrote: > > I am trying to override variables in a class that is defined in the > default node profile. I want parent class to be included in every single > node, but override its variables in others. I have tried > it several different ways now, and every single time the variables either > become unset (undefined) or are set to the value of the first if statement. > > Here is my current iteration of failure. warn_real is always equal > to processorcount, no matter if I override it or not. > > class nrpe::load ($warn = 'UNSET', $crit = 'UNSET') { > > package { nagios-plugins-load: ensure => installed } > > if $warn == 'UNSET' { > $warn_real = $processorcount > } > if $crit == 'UNSET' { > $crit_real = $processorcount * 2 > } > > file { "/etc/nagios/command.d/load.cfg": > owner => root, > group => root, > mode => 640, > content => template("nrpe/load.cfg.erb"), > notify => Service[nrpe] > } > } > > > class nrpe::load::override($warn = 'UNSET', $crit = 'UNSET') inherits > nrpe::load { > > Class["nrpe::load"] { > warn => $warn, > crit => $crit > } > } > > node "somenode.tld" inherits basenode { > class {'nrpe::load::override': > warn => 5, > crit => 10 > } > } > > -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/aZCaK4L7k_4J. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.