2 ## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE.
3 ## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git
10 lines << "# This file has been autogenerated and pushed by puppet. Edit static-components.yaml in puppet."
11 lines << "# <master> <service> <source host> <directory> <extra push hosts, comma separated> <hosts to not mirror this component to>"
14 config = YAML.load(File.open('/etc/puppet/modules/roles/misc/static-components.yaml').read)
15 mirrors = scope.lookupvar('site::roles')['static_mirror']
17 config['components'].each_pair do |component, conf|
18 %w{exclude-mirrors extra-push limit-mirrors}.each do |key|
19 conf[key] = [] unless conf.has_key?(key)
22 srchost, srcpath = conf['source'].split(':', 2)
24 config['mirrors'].each do |mirror, mc|
25 next unless mirrors.include?(mirror)
27 if mc.has_key?('components-include') and not mc['components-include'].include?(component)
28 conf['exclude-mirrors'] << mirror
31 if conf['limit-mirrors'].size > 0
32 mirrors.each do |mirror|
33 if not conf['limit-mirrors'].include?(mirror)
34 next if conf['exclude-mirrors'].include?(mirror) # if it's already excluded, do not add it again
35 conf['exclude-mirrors'] << mirror
40 exclude = conf['exclude-mirrors'].join(',')
41 exclude = '-' unless exclude != ""
42 extrapush = conf['extra-push'].join(',')
43 extrapush = '-' unless extrapush != ""
45 lines << "#{conf['master']} #{component} #{srchost} #{srcpath} #{extrapush} #{exclude}"