From: Peter Palfrader Date: Tue, 8 Nov 2016 19:47:12 +0000 (+0000) Subject: support shipping a component to just a few mirrors X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=14dbe81b92fcbc6ca8328d8fb39293761297b4bf;p=mirror%2Fdsa-puppet.git support shipping a component to just a few mirrors --- diff --git a/modules/roles/templates/static-mirroring/static-components.conf.erb b/modules/roles/templates/static-mirroring/static-components.conf.erb index 1656082d1..117828e0c 100644 --- a/modules/roles/templates/static-mirroring/static-components.conf.erb +++ b/modules/roles/templates/static-mirroring/static-components.conf.erb @@ -15,7 +15,7 @@ config = YAML.load(File.open('/etc/puppet/modules/roles/misc/static-components.y mirrors = scope.lookupvar('site::roles')['static_mirror'] config['components'].each_pair do |component, conf| - %w{exclude-mirrors extra-push}.each do |key| + %w{exclude-mirrors extra-push limit-mirrors}.each do |key| conf[key] = [] unless conf.has_key?(key) end @@ -28,6 +28,14 @@ config['components'].each_pair do |component, conf| conf['exclude-mirrors'] << mirror end end + if conf['limit-mirrors'].size > 0 + mirrors.each do |mirror| + if not conf['limit-mirrors'].include?(mirror) + next if conf['exclude-mirrors'].include?(mirror) # if it's already excluded, do not add it again + conf['exclude-mirrors'] << mirror + end + end + end exclude = conf['exclude-mirrors'].join(',') exclude = '-' unless exclude != ""