From 14dbe81b92fcbc6ca8328d8fb39293761297b4bf Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Tue, 8 Nov 2016 19:47:12 +0000 Subject: [PATCH] support shipping a component to just a few mirrors --- .../static-mirroring/static-components.conf.erb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 != "" -- 2.20.1