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/-/3-A3XgYtmh8J.
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.

Reply via email to