From: Peter Palfrader Date: Sat, 11 Feb 2012 13:50:59 +0000 (+0100) Subject: Try to work around broken arm firewall X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=6210118a7332dd13d1a7c96cd61f2da44e7b2692;p=mirror%2Fdsa-puppet.git Try to work around broken arm firewall --- diff --git a/modules/debian-org/misc/hoster.yaml b/modules/debian-org/misc/hoster.yaml index 32052b9c6..f953433f6 100644 --- a/modules/debian-org/misc/hoster.yaml +++ b/modules/debian-org/misc/hoster.yaml @@ -32,6 +32,7 @@ arm: - 217.140.96.58/29 nameservers_break_dnssec: true nameservers: [158.43.128.1, 217.140.108.113] + entropy_provider_hoster: sil br: # University Federal do Parana (.br) netrange: diff --git a/modules/puppetmaster/lib/puppet/parser/functions/entropy_provider.rb b/modules/puppetmaster/lib/puppet/parser/functions/entropy_provider.rb index 1a0f8e9b7..52194cbf8 100644 --- a/modules/puppetmaster/lib/puppet/parser/functions/entropy_provider.rb +++ b/modules/puppetmaster/lib/puppet/parser/functions/entropy_provider.rb @@ -31,14 +31,26 @@ module Puppet::Parser::Functions end # figure out which entropy provider to use - consumer_hoster = nodeinfo['hoster']['name'] + consumer_hoster = nodeinfo['hoster'] + consumer_hoster_name = nodeinfo['hoster']['name'] + + if consumer_hoster['entropy_provider_hoster'] and hoster[consumer_hoster['entropy_provider_hoster']] + # if we have a preferred entropy provider hoster for hosts at this one. + entropy_provider_hoster = consumer_hoster['entropy_provider_hoster'] + elsif hoster[consumer_hoster_name] + # if there are any at the same hoster, use one of them + entropy_provider_hoster = consumer_hoster_name + else + entropy_provider_hoster = nil + end + if provider.include?(fqdn) # if the host has an ekeyd ans = 'local' - elsif hoster[consumer_hoster] # if there are any at the same hoster, use one of them + elsif entropy_provider_hoster # if there are more than one ekeys at this hoster pick an arbitrary # one, but the same every time - index = fqdn.hash % hoster[consumer_hoster].length - ans = hoster[consumer_hoster][index] + index = fqdn.hash % hoster[entropy_provider_hoster].length + ans = hoster[entropy_provider_hoster][index] else # pick an arbitrary provider from all providers index = fqdn.hash % provider.size ans = provider[index]