From 16eed32a3024a77e67ff9cab8e0126d3777484d1 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Wed, 29 May 2013 09:32:56 +0000 Subject: [PATCH] puppetmaster -> wheezy, Pt I --- modules/debian-org/misc/hoster.yaml | 2 +- modules/ferm/templates/me.conf.erb | 2 +- ...bsolete-packages-ignore.d-hostspecific.erb | 46 +++++++++---------- modules/puppetmaster/files/hiera.yaml | 6 +-- .../puppet/parser/functions/allnodeinfo.rb | 2 +- .../parser/functions/entropy_provider.rb | 2 +- .../lib/puppet/parser/functions/nodeinfo.rb | 10 ++-- .../lib/puppet/parser/functions/yamlinfo.rb | 8 ++-- modules/puppetmaster/manifests/init.pp | 4 +- modules/site/manifests/params.pp | 6 --- modules/site/templates/aptrepo.erb | 2 +- 11 files changed, 39 insertions(+), 51 deletions(-) delete mode 100644 modules/site/manifests/params.pp diff --git a/modules/debian-org/misc/hoster.yaml b/modules/debian-org/misc/hoster.yaml index 3a8bfaa23..48e80b7a8 100644 --- a/modules/debian-org/misc/hoster.yaml +++ b/modules/debian-org/misc/hoster.yaml @@ -150,7 +150,7 @@ ubcece: - 206.12.19.0/24 searchpaths: [debprivate-ubc.debian.org] mirror-debian: http://mirror-ubc.debian.org/debian/ - nameservers: [206.12.19.214, 2607:f8f0:610:4000:224:81ff:fea7:e952, 206.12.19.20, 2607:f8f0:610:4000:218:feff:fe76:2ed0, 206.12.19.21, 2607:f8f0:610:4000:21c:c4ff:fee5:e890] + nameservers: ['206.12.19.214', '2607:f8f0:610:4000:224:81ff:fea7:e952', '206.12.19.20', '2607:f8f0:610:4000:218:feff:fe76:2ed0', '206.12.19.21', '2607:f8f0:610:4000:21c:c4ff:fee5:e890'] ugent: netrange: - 157.193.0.0/16 diff --git a/modules/ferm/templates/me.conf.erb b/modules/ferm/templates/me.conf.erb index 69b8fa5dd..a6aebec5a 100644 --- a/modules/ferm/templates/me.conf.erb +++ b/modules/ferm/templates/me.conf.erb @@ -6,7 +6,7 @@ <%= out = [] -restricted_purposes = {'kvm host', 'central syslog server', 'puppet master', 'jumphost'} +restricted_purposes = ['kvm host', 'central syslog server', 'puppet master', 'jumphost'] restrict_ssh = %w{lebrun geo1 geo2 geo3 beethoven tchaikovsky schroeder draghi} if (scope.lookupvar('site::nodeinfo')['ldap'].has_key?('purpose')) then diff --git a/modules/nagios/templates/obsolete-packages-ignore.d-hostspecific.erb b/modules/nagios/templates/obsolete-packages-ignore.d-hostspecific.erb index f50eef92c..813d7e639 100644 --- a/modules/nagios/templates/obsolete-packages-ignore.d-hostspecific.erb +++ b/modules/nagios/templates/obsolete-packages-ignore.d-hostspecific.erb @@ -1,42 +1,38 @@ ## ## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE. -## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git +## USE then git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git ## <%= ignore = [] case fqdn -when "bellini.debian.org": ignore << "mcelog" -when "cilea.debian.org": ignore << "/freeswitch.*/" -when /draghi.debian.org/: ignore << %w{userdir-ldap userdir-ldap-cgi libheimdal-kadm5-perl django-ldapdb} -when /orff.debian.org/: ignore << %w{libnet-dns-sec-perl libnet-dns-zone-parser-perl} -when /(zandonai|zelenka).debian.org/: ignore << %w{samhain zabbix-agent rrdcollect} -when /zappa.debian.org/: ignore << %w{samhain} -when /(mayer|corelli).debian.org/: ignore << "linux-base" -when /(alkman|caballero|merulo|mundy).debian.org/: ignore << "samhain" -when "franck.debian.org": ignore << %w{python-apt} -when /(abel|arnold|alain|alwyn|antheil|arne).debian.org/: ignore << %w{flash-kernel linux-firmware-image} -when /harris.debian.org/: ignore << %w{flash-kernel kernel linux-firmware-image} -when /(hasse|hebden|henze|hildegard|howells|hummel|hoiby).debian.org/: ignore << %w{flash-kernel kernel linux-firmware-image schroot schroot-common} -when /(parry|partch|piston).debian.org/: ignore << "yaboot" - -when "grieg.debian.org": ignore << %w{dpkg} -when "blavet.debian.org": ignore << %w{dpkg-dev libdpkg-perl dpkg} -when "handel.debian.org": ignore << %w{puppet-dashboard} -when "reger.debian.org": ignore << %w{librt-extension-commandbymail-perl} -when /(pasquini|tristano).debian.org/: ignore << %w{ganeti-instance-image} +when "bellini.debian.org" then ignore << "mcelog" +when "cilea.debian.org" then ignore << "/freeswitch.*/" +when /draghi.debian.org/ then ignore << %w{userdir-ldap userdir-ldap-cgi libheimdal-kadm5-perl django-ldapdb} +when /orff.debian.org/ then ignore << %w{libnet-dns-sec-perl libnet-dns-zone-parser-perl} +when /(zandonai|zelenka).debian.org/ then ignore << %w{samhain zabbix-agent rrdcollect} +when /zappa.debian.org/ then ignore << %w{samhain} +when /(mayer|corelli).debian.org/ then ignore << "linux-base" +when /(alkman|caballero|merulo|mundy).debian.org/ then ignore << "samhain" +when "franck.debian.org" then ignore << %w{python-apt} +when /(abel|arnold|alain|alwyn|antheil|arne).debian.org/ then ignore << %w{flash-kernel linux-firmware-image} +when /harris.debian.org/ then ignore << %w{flash-kernel kernel linux-firmware-image} +when /(hasse|hebden|henze|hildegard|howells|hummel|hoiby).debian.org/ then ignore << %w{flash-kernel kernel linux-firmware-image} +when /(parry|partch|piston).debian.org/ then ignore << "yaboot" +when "grieg.debian.org" then ignore << %w{dpkg} +when "blavet.debian.org" then ignore << %w{dpkg-dev libdpkg-perl dpkg} +when "handel.debian.org" then ignore << %w{puppet-dashboard} +when "reger.debian.org" then ignore << %w{librt-extension-commandbymail-perl} +when /(pasquini|tristano).debian.org/ then ignore << %w{ganeti-instance-image} end case fqdn -when /geo[123].debian.org/: ignore << %w{geoip-database} +when /geo[123].debian.org/ then ignore << %w{geoip-database} end if fqdn == "arne.debian.org" - ignore << %w{/linux-headers-.*/} + ignore << %w{/linux-headers-.*/} end -#case fqdn -#when /(draghi|orff|ravel|klecker|geo[123]).debian.org/: ignore << %w{libdns69 libdns66 libdns64 bind9 libbind9-60 liblwres60 bind9-host libisccfg62 libisccfg60 libisc62 libisc60 dnsutils bind9utils libisccc60} -#end ignore.flatten.join("\n") %> diff --git a/modules/puppetmaster/files/hiera.yaml b/modules/puppetmaster/files/hiera.yaml index 54fab8b91..216f65fc0 100644 --- a/modules/puppetmaster/files/hiera.yaml +++ b/modules/puppetmaster/files/hiera.yaml @@ -1,8 +1,8 @@ --- :hierarchy: - - %{hoster} - - clusters/%{cluster} - - common + - '%{hoster}' + - 'clusters/%{cluster}' + - 'common' :backends: - yaml :yaml: diff --git a/modules/puppetmaster/lib/puppet/parser/functions/allnodeinfo.rb b/modules/puppetmaster/lib/puppet/parser/functions/allnodeinfo.rb index 11baf101b..012d58eac 100644 --- a/modules/puppetmaster/lib/puppet/parser/functions/allnodeinfo.rb +++ b/modules/puppetmaster/lib/puppet/parser/functions/allnodeinfo.rb @@ -4,7 +4,7 @@ module Puppet::Parser::Functions required = args.shift.split() optional = args.shift.split() - allhosts = function_ldapinfo('*', *(required+optional) ) + allhosts = function_ldapinfo(['*', *(required+optional) ]) res = {} allhosts.each_pair do |hostname, host| # If a returned value doesn't have all the attributes we're searching for, skip diff --git a/modules/puppetmaster/lib/puppet/parser/functions/entropy_provider.rb b/modules/puppetmaster/lib/puppet/parser/functions/entropy_provider.rb index ef73e5dc7..19b3366f7 100644 --- a/modules/puppetmaster/lib/puppet/parser/functions/entropy_provider.rb +++ b/modules/puppetmaster/lib/puppet/parser/functions/entropy_provider.rb @@ -21,7 +21,7 @@ module Puppet::Parser::Functions next unless localinfo[node]['entropy_key'] addresses = allnodeinfo[node]['ipHostNumber'] - thishoster = function_whohosts(addresses, "/etc/puppet/modules/debian-org/misc/hoster.yaml") + thishoster = function_whohosts([addresses, "/etc/puppet/modules/debian-org/misc/hoster.yaml"]) name = thishoster['name'] provider << node diff --git a/modules/puppetmaster/lib/puppet/parser/functions/nodeinfo.rb b/modules/puppetmaster/lib/puppet/parser/functions/nodeinfo.rb index 7a02be462..cca270c5a 100644 --- a/modules/puppetmaster/lib/puppet/parser/functions/nodeinfo.rb +++ b/modules/puppetmaster/lib/puppet/parser/functions/nodeinfo.rb @@ -7,12 +7,12 @@ module Puppet::Parser::Functions require '/var/lib/puppet/lib/puppet/parser/functions/ldapinfo.rb' require '/var/lib/puppet/lib/puppet/parser/functions/whohosts.rb' - nodeinfo = function_yamlinfo(host, yamlfile) - nodeinfo['ldap'] = function_ldapinfo(host, '*') + nodeinfo = function_yamlinfo([host, yamlfile]) + nodeinfo['ldap'] = function_ldapinfo([host, '*']) unless nodeinfo['ldap']['ipHostNumber'] raise Puppet::ParseError, "Host #{host} does not have ipHostNumber values in ldap" end - nodeinfo['hoster'] = function_whohosts(nodeinfo['ldap']['ipHostNumber'], "/etc/puppet/modules/debian-org/misc/hoster.yaml") + nodeinfo['hoster'] = function_whohosts([nodeinfo['ldap']['ipHostNumber'], "/etc/puppet/modules/debian-org/misc/hoster.yaml"]) nodeinfo['buildd'] = (nodeinfo['ldap']['purpose'].respond_to?('include?') && nodeinfo['ldap']['purpose'].include?('buildd')) if lookupvar('::mta') == 'exim4' @@ -39,8 +39,8 @@ module Puppet::Parser::Functions end end - ns = function_hiera('nameservers') - allow_dns_q = function_hiera('allow_dns_query') + ns = function_hiera(['nameservers']) + allow_dns_q = function_hiera(['allow_dns_query']) if ns.empty? # no nameservers known for this hoster nodeinfo['misc']['resolver-recursive'] = true diff --git a/modules/puppetmaster/lib/puppet/parser/functions/yamlinfo.rb b/modules/puppetmaster/lib/puppet/parser/functions/yamlinfo.rb index cb53ada9a..8f705c8d8 100644 --- a/modules/puppetmaster/lib/puppet/parser/functions/yamlinfo.rb +++ b/modules/puppetmaster/lib/puppet/parser/functions/yamlinfo.rb @@ -6,7 +6,7 @@ module Puppet::Parser::Functions parser = Puppet::Parser::Parser.new(environment) parser.watch_file(yamlfile) - def read_yaml(yaml, host) + read_yaml = lambda { |yaml, host| results = {} ['nameinfo', 'footer'].each do |detail| @@ -40,7 +40,7 @@ module Puppet::Parser::Functions end end return(results) - end + } require 'yaml' $KCODE = 'utf-8' @@ -52,10 +52,10 @@ module Puppet::Parser::Functions Dir.entries('/var/lib/puppet/yaml/node/').each do |fname| next unless fname =~ /(.*)\.yaml$/ host_name = $1 - ret[host_name] = read_yaml(yaml, host_name) + ret[host_name] = read_yaml.call(yaml, host_name) end else - ret = read_yaml(yaml, host) + ret = read_yaml.call(yaml, host) end return(ret) diff --git a/modules/puppetmaster/manifests/init.pp b/modules/puppetmaster/manifests/init.pp index 43432af7b..f1c567dcc 100644 --- a/modules/puppetmaster/manifests/init.pp +++ b/modules/puppetmaster/manifests/init.pp @@ -1,9 +1,7 @@ class puppetmaster { - include site::params - package { 'puppetmaster': - ensure => $site::params::puppetversion, + ensure => installed, } file { '/etc/puppet/hiera.yaml': source => 'puppet:///modules/puppetmaster/hiera.yaml' diff --git a/modules/site/manifests/params.pp b/modules/site/manifests/params.pp deleted file mode 100644 index 211c45f2f..000000000 --- a/modules/site/manifests/params.pp +++ /dev/null @@ -1,6 +0,0 @@ -class site::params { - $puppetversion = $::hostname ? { - handel => '2.7.18-3~bpo60+1', - default => '2.6.2-5+squeeze5', - } -} diff --git a/modules/site/templates/aptrepo.erb b/modules/site/templates/aptrepo.erb index a826fa276..9469d138a 100644 --- a/modules/site/templates/aptrepo.erb +++ b/modules/site/templates/aptrepo.erb @@ -3,4 +3,4 @@ ### USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git ### -deb <%= scope.lookupvar('url') %> <%= scope.lookupvar('suite') %> <%= scope.lookupvar('components').to_a.join(' ') %> +deb <%= scope.lookupvar('url') %> <%= scope.lookupvar('suite') %> <%= [scope.lookupvar('components')].flatten.join(' ') %> -- 2.20.1