From 4507cd7d464dfa7d1f3cec02fac917e59ab514bf Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Tue, 26 May 2009 20:24:31 +0200 Subject: [PATCH] Try to refactor nodeinfo.rb - Hope this doesn't break too badly --- .../lib/puppet/parser/functions/nodeinfo.rb | 26 +++----- modules/debian-org/misc/local.yaml | 63 ++++++++++--------- 2 files changed, 40 insertions(+), 49 deletions(-) diff --git a/files/etc/puppet/lib/puppet/parser/functions/nodeinfo.rb b/files/etc/puppet/lib/puppet/parser/functions/nodeinfo.rb index aa641c3cf..94e806c89 100644 --- a/files/etc/puppet/lib/puppet/parser/functions/nodeinfo.rb +++ b/files/etc/puppet/lib/puppet/parser/functions/nodeinfo.rb @@ -34,24 +34,14 @@ module Puppet::Parser::Functions results['smarthost_port'] = 587 results['reservedaddrs'] = '0.0.0.0/8 : 127.0.0.0/8 : 10.0.0.0/8 : 169.254.0.0/16 : 172.16.0.0/12 : 192.0.0.0/17 : 192.168.0.0/16 : 224.0.0.0/4 : 240.0.0.0/5 : 248.0.0.0/5' - if yaml.has_key?('mail_port') and yaml['mail_port'].has_key?(host) - results['mail_port'] = yaml['mail_port'][host] - end - - if yaml.has_key?('need_smarthost') and yaml['need_smarthost'].include?(host) - results['smarthost'] = "mailout.debian.org" - end - - if yaml.has_key?('reservedaddrs') and yaml['reservedaddrs'].has_key?(host) - results['reservedaddrs'] = yaml['reservedaddrs'][host] - end - - if yaml.has_key?('heavy_exim') and yaml['heavy_exim'].include?(host) - results['heavy_exim'] = "true" - end - - if yaml.has_key?('apache2_defaultconfig') and yaml['apache2_defaultconfig'].include?(host) - results['apache2_defaultconfig'] = "true" + if yaml['host_settings'].kind_of?(Hash) + yaml['host_settings'].each_key do |property, values| + if values.kind_of?(Hash) + results[property] = values[host] if values.has_key?(host) + elsif values.kind_of?(Array) + results[property] = "true" if values.include?(host) + end + end end ldap = LDAP::Conn.new('db.debian.org') diff --git a/modules/debian-org/misc/local.yaml b/modules/debian-org/misc/local.yaml index c40d45ff3..f6aa9725b 100644 --- a/modules/debian-org/misc/local.yaml +++ b/modules/debian-org/misc/local.yaml @@ -65,30 +65,6 @@ footer: schroeder.debian.org: "- This host is using an iptables firewall. See /etc/rc.boot/firewall{,6}" verdi.debian.org: "- This host is using an iptables firewall. See /etc/ferm/ferm.conf" zelenka.debian.org: "Debian s390 porter system kindly provided by Zentrum fuer Informationsverarbeitung und Informationstechnik [zivit]" -need_smarthost: - - ancina.debian.org - - allegri.debian.org - - piatti.debian.org -heavy_exim: - - raff.debian.org - - gluck.debian.org - - merkel.debian.org - - spohr.debian.org - - draghi.debian.org - - master.debian.org - - ries.debian.org - - rietz.debian.org - - klecker.debian.org - - powell.debian.org -apache2_defaultconfig: - - carver.debian.org - - draghi.debian.org - - duarte.debian.org - - piatti.debian.org - - rore.debian.org - - saens.debian.org - - samosa.debian.org - - tartini.debian.org services: bugsmaster: rietz.debian.org qamaster: merkel.debian.org @@ -96,12 +72,37 @@ services: rtmaster: spohr.debian.org packagesmaster: powell.debian.org packagesqamaster: master.debian.org -mail_port: - ancina.debian.org: 2025 - allegri.debian.org: 2025 - piatti.debian.org: 2025 - kassia.debian.org: 587 -reservedaddrs: - ball.debian.org: "0.0.0.0/8 : 127.0.0.0/8 : 10.0.0.0/8 : 169.254.0.0/16 : 172.16.0.0/12 : 192.0.0.0/17 : 192.168.0.0/16 : 224.0.0.0/4 : 240.0.0.0/5 : 248.0.0.0/5" +host_settings: + heavy_exim: + - raff.debian.org + - gluck.debian.org + - merkel.debian.org + - spohr.debian.org + - draghi.debian.org + - master.debian.org + - ries.debian.org + - rietz.debian.org + - klecker.debian.org + - powell.debian.org + apache2_defaultconfig: + - carver.debian.org + - draghi.debian.org + - duarte.debian.org + - piatti.debian.org + - rore.debian.org + - saens.debian.org + - samosa.debian.org + - tartini.debian.org + smarthost: + ancina.debian.org: mailout.debian.org + allegri.debian.org: mailout.debian.org + piatti.debian.org: mailout.debian.org + mail_port: + ancina.debian.org: 2025 + allegri.debian.org: 2025 + piatti.debian.org: 2025 + kassia.debian.org: 587 + reservedaddrs: + ball.debian.org: "0.0.0.0/8 : 127.0.0.0/8 : 10.0.0.0/8 : 169.254.0.0/16 : 172.16.0.0/12 : 192.0.0.0/17 : 192.168.0.0/16 : 224.0.0.0/4 : 240.0.0.0/5 : 248.0.0.0/5" --- -- 2.20.1