From: Peter Palfrader Date: Tue, 31 Jul 2018 08:10:59 +0000 (+0200) Subject: ferm/munin: use already split v[46]addrs for munin addresses X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=ec98ab10b80a84d56e9d88198cd39910190f9f78;p=mirror%2Fdsa-puppet.git ferm/munin: use already split v[46]addrs for munin addresses --- diff --git a/modules/ferm/manifests/init.pp b/modules/ferm/manifests/init.pp index 9290d35c0..527881682 100644 --- a/modules/ferm/manifests/init.pp +++ b/modules/ferm/manifests/init.pp @@ -29,12 +29,14 @@ class ferm { status => '/bin/true', } - $munin_ips = split(regsubst($::v4ips, '([^,]+)', 'ip_\1', 'G'), ',') + $munin_ips = getfromhash($site::nodeinfo, 'misc', 'v4addrs') + .map |$addr| { "ip_${addr}" } munin::check { $munin_ips: script => 'ip_', } - if $v6ips { - $munin6_ips = split(regsubst($::v6ips, '([^,]+)', 'ip_\1', 'G'), ',') + if getfromhash($site::nodeinfo, 'misc', 'v6addrs') { + $munin6_ips = getfromhash($site::nodeinfo, 'misc', 'v6addrs') + .map |$addr| { "ip_${addr}" } munin::ipv6check { $munin6_ips: } } diff --git a/modules/ferm/templates/interfaces.conf.erb b/modules/ferm/templates/interfaces.conf.erb index 496054c42..c504725fb 100644 --- a/modules/ferm/templates/interfaces.conf.erb +++ b/modules/ferm/templates/interfaces.conf.erb @@ -1,13 +1,13 @@ def $MUNIN_IPS = (<%= begin - scope.lookupvar('::v4ips').split(',').join(' ') + scope.lookupvar('site::nodeinfo')['misc']['v4addrs'].join(' ') rescue '' end %>); def $MUNIN6_IPS = (<%= begin - scope.lookupvar('::v6ips') == '' ? '' : scope.lookupvar('::v6ips').split(',').join(' ') + scope.lookupvar('site::nodeinfo')['misc']['v6addrs'].join(' ') rescue '' end