<%=
def getbuilddkey(host)
- key = nil
- begin
- facts = YAML.load(File.open("/var/lib/puppet/yaml/facts/#{host}.yaml").read)
- return facts.values['buildd_key']
- rescue Exception => e
- end
- return key
+ key = nil
+ begin
+ facts = YAML.load(File.open("/var/lib/puppet/yaml/facts/#{host}.yaml").read)
+ return facts.values['buildd_key']
+ rescue Exception => e
+ end
+ return key
end
allnodeinfo = scope.lookupvar('site::allnodeinfo')
-roles = scope.lookupvar('site::roles')
+buildds = []
-mirrors = []
-roles['buildd'].each do |node|
- key = getbuilddkey(node)
- mirrors << { 'node' => node, 'addr' => allnodeinfo[node]['ipHostNumber'], 'key' => key}
+allnodeinfo.keys.sort.each do |node|
+ next unless scope.lookupvar('site::allnodeinfo')[node]['purpose']
+ next unless scope.lookupvar('site::allnodeinfo')[node]['purpose'].include?('buildd')
+ key = getbuilddkey(node)
+ buildds << { 'node' => node, 'addr' => allnodeinfo[node]['ipHostNumber'], 'key' => key}
end
lines = []
-for m in mirrors do
- lines << '# ' + m['node']
- if m['key'].nil?
- lines << "# no key for node"
- else
- lines << "command=\"/srv/wanna-build/bin/wanna-build --ssh-wrapper #{m['node']}\"," +
- 'no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-user-rc,' +
- 'from="' + m['addr'].join(',') + '" ' +
- m['key']
- end
+for m in buildds do
+ lines << '# ' + m['node']
+ if m['key'].nil?
+ lines << "# no key for node"
+ else
+ lines << "command=\"/srv/wanna-build/bin/wanna-build --ssh-wrapper #{m['node']}\"," +
+ 'no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-user-rc,' +
+ 'from="' + m['addr'].join(',') + '" ' +
+ m['key']
+ end
end
lines.join("\n")