Extending puppet modules and access to parameters

If I extend class rsyslog::client by creating something like so:

class misc::rsyslog inherits rsyslog::client {

if $configserver_firewall == 'true' {
file_line { "rsyslog_client_fw_entry" :
path => '/etc/csf/csf.allow',
line => 'udp|out|d=514|d=192.168.0.21 # rsyslog_client_fw_entry',
ensure => 'present',
}
}
}

How am I supposed to be able to override any of the default values in
foreman of the rsyslog::client class? These parameters dont show up in the
new class in foreman (though they get ran when the new class is ran) and
anything overridden in the original class simply isnt applied because thats
technically not the class that is being assigned to a host. Hopefully I am
making some sense.

Puppet Best practice is to not use class inheritance.

Why do you need to inherit anyways?

You can should be able to restructure your puppet code to work around this
issue.

Without seeing the full puppet code I can only guess that this might work.

class misc::rsyslog{

if $rsyslog::client::configserver_firewall == 'true' { 
...

}
}

Also why would you not put this code in the syslog::client class?

Corey

ยทยทยท On Thursday, February 5, 2015 at 12:20:05 AM UTC-8, Mark Chaney wrote: > > If I extend class rsyslog::client by creating something like so: > > class misc::rsyslog inherits rsyslog::client { > > if $configserver_firewall == 'true' { > file_line { "rsyslog_client_fw_entry" : > path => '/etc/csf/csf.allow', > line => 'udp|out|d=514|d=192.168.0.21 # rsyslog_client_fw_entry', > ensure => 'present', > } > } > } > > How am I supposed to be able to override any of the default values in > foreman of the rsyslog::client class? These parameters dont show up in the > new class in foreman (though they get ran when the new class is ran) and > anything overridden in the original class simply isnt applied because thats > technically not the class that is being assigned to a host. Hopefully I am > making some sense. >

Inheritance is the only way to extend a class without modifying that
modules code directly. Correct? The point of it to add functionality to a
module without touching its code and having to assign yet another class to
a host or hostgroup.