config = YAML.load(File.open('/etc/puppet/modules/roles/misc/static-components.yaml').read)
mirrors = scope.lookupvar('site::roles')['static_mirror']
-config['components'].each_pair do |component, conf|
+config['components'].each_pair do |component_name, component_conf|
%w{exclude-mirrors extra-push limit-mirrors}.each do |key|
- conf[key] = [] unless conf.has_key?(key)
+ component_conf[key] = [] unless component_conf.has_key?(key)
end
- srchost, srcpath = conf['source'].split(':', 2)
+ srchost, srcpath = component_conf['source'].split(':', 2)
config['mirrors'].each do |mirror, mc|
next unless mirrors.include?(mirror)
- if mc.has_key?('components-include') and not mc['components-include'].include?(component)
- conf['exclude-mirrors'] << mirror
+ if mc.has_key?('components-include') and not mc['components-include'].include?(component_name)
+ component_conf['exclude-mirrors'] << mirror
end
end
- if conf['limit-mirrors'].size > 0
+ if component_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
+ if not component_conf['limit-mirrors'].include?(mirror)
+ next if component_conf['exclude-mirrors'].include?(mirror) # if it's already excluded, do not add it again
+ component_conf['exclude-mirrors'] << mirror
end
end
end
- exclude = conf['exclude-mirrors'].join(',')
+ exclude = component_conf['exclude-mirrors'].join(',')
exclude = '-' unless exclude != ""
- extrapush = conf['extra-push'].join(',')
+ extrapush = component_conf['extra-push'].join(',')
extrapush = '-' unless extrapush != ""
- lines << "#{conf['master']} #{component} #{srchost} #{srcpath} #{extrapush} #{exclude}"
+ lines << "#{component_conf['master']} #{component_name} #{srchost} #{srcpath} #{extrapush} #{exclude}"
end
lines.join("\n")
%>