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_name, component_conf|
18 %w{exclude-mirrors extra-push limit-mirrors}.each do |key|
19 component_conf[key] = [] unless component_conf.has_key?(key)
22 srchost, srcpath = component_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_name)
28 component_conf['exclude-mirrors'] << mirror
31 if component_conf['limit-mirrors'].size > 0
32 mirrors.each do |mirror|
33 if not component_conf['limit-mirrors'].include?(mirror)
34 next if component_conf['exclude-mirrors'].include?(mirror) # if it's already excluded, do not add it again
35 component_conf['exclude-mirrors'] << mirror
41 exclude = component_conf['exclude-mirrors'].sort().join(',')
42 exclude = '-' unless exclude != ""
43 extrapush = component_conf['extra-push'].sort().join(',')
44 extrapush = '-' unless extrapush != ""
46 lines << "#{component_conf['master']} #{component_name} #{srchost} #{srcpath} #{extrapush} #{exclude}"