## ## THIS FILE IS UNDER PUPPET CONTROL. DON'T EDIT IT HERE. ## USE: git clone git+ssh://$USER@puppet.debian.org/srv/puppet.debian.org/git/dsa-puppet.git ## <%= lines = [] lines << "# This file has been autogenerated and pushed by puppet. Edit static-components.yaml in puppet." lines << "# " # this is the list of static mirrors, or, technically, the list of # nodes with the roles::static_mirror class applied to it. this should # be populated from outside the template from PuppetDB, see: # modules/roles/manifests/static_base.pp mirrors = @static_mirrors config = YAML.load(File.open('/etc/puppet/modules/roles/misc/static-components.yaml').read) config['mirrors'].each do |mirror, mc| if not mirrors.include?(mirror) fail("static-components.yaml defines mirror #{mirror} but we do not know of it") end end config['components'].each_pair do |component_name, component_conf| %w{exclude-mirrors extra-push limit-mirrors}.each do |key| component_conf[key] = [] unless component_conf.has_key?(key) end srchost, srcpath = component_conf['source'].split(':', 2) if not component_conf['exclude-mirrors'].empty? and \ not component_conf['limit-mirrors'].empty? then fail("Component #{component_name} specifies both exclude-mirrors and limit-mirrors.") end # In the end, we care about an exclude list, so let's invert limit-mirror and turn it into an exclude list if not component_conf['limit-mirrors'].empty? then component_conf['exclude-mirrors'] = mirrors.select do |m| not component_conf['limit-mirrors'].include?(m) end end # mirrors may also specify limits as components-include (thus excluding all others). Apply this config['mirrors'].each do |mirror, mc| mirror_components_include = mc.fetch('components-include', []) next if mirror_components_include.empty? if not mirror_components_include.include?(component_name) next if component_conf['exclude-mirrors'].include?(mirror) # do not exclude twice component_conf['exclude-mirrors'] << mirror end end exclude = component_conf['exclude-mirrors'].sort().join(',') exclude = '-' if exclude == "" extrapush = component_conf['extra-push'].sort().join(',') extrapush = '-' if extrapush == "" lines << "#{component_conf['master']} #{component_name} #{srchost} #{srcpath} #{extrapush} #{exclude}" end lines.join("\n") %>