params_lookup on Puppet4 with subclass params
Poil opened this issue · 2 comments
Poil commented
Hi,
On Puppet 3.8 I have no problem with this module, but with Puppet 4 params_lookup return an empty string :
class zabbix::agent (
$mirror_host = params_lookup('mirror_host', 'global'),
$listen_address = params_lookup('listen_address'),
$admin_address = params_lookup('admin_address', 'global'),
$proxies = params_lookup('proxies'),
) inherits zabbix::agent::params {
if empty($admin_address) {
notify { 'empty': }
$_listen_address = $listen_address ? {
/^ipaddress_.*/ => get_magicvar($listen_address),
default => $listen_address
}
} else {
notify { 'not empty': }
$_listen_address = $admin_address ? {
/^ipaddress_.*/ => get_magicvar($admin_address),
default => $admin_address
}
}
notify { "admin_address: ${admin_address}": }
notify { "listen_address: ${listen_address}": }
notify { "_listen_address: ${_listen_address}": }
class zabbix::agent::params {
$listen_address = $::ipaddress
}
Notice: empty
Notice: /Stage[main]/Zabbix::Agent/Notify[empty]/message: defined 'message' as 'empty'
Notice: admin_address:
Notice: /Stage[main]/Zabbix::Agent/Notify[admin_address: ]/message: defined 'message' as 'admin_address: '
Notice: listen_address:
Notice: /Stage[main]/Zabbix::Agent/Notify[listen_address: ]/message: defined 'message' as 'listen_address: '
Notice: _listen_address:
Notice: /Stage[main]/Zabbix::Agent/Notify[_listen_address: ]/message: defined 'message' as '_listen_address: '
Notice: /Stage[main]/Sssd::Service/Service[messagebus]/ensure: ensure changed 'stopped' to 'running'
- mirror_host is working (coming from hiera)
- proxies is working (coming from hiera)
- listen_address is empty, should be equals to $::ipaddress
I think there is something broken on Puppet4 with value from ::classname::params
Any idea ? :)
Best regards,
Poil commented
I think I've got my answer :(
# TODO: Set the correct classname when params_lookup used in subclasses
classname = modulename
Poil commented
Ok I've got a quick fix, change this line with
classname = scope.namespaces.first