1 module Puppet::Parser::Functions
2 newfunction(:nodeinfo, :type => :rvalue) do |args|
6 parser.watch_file(yamlfile)
13 yaml = YAML.load_file(yamlfile)
16 ['nameinfo', 'footer'].each do |detail|
17 if yaml.has_key?(detail)
18 if yaml[detail].has_key?(host)
19 results[detail] = yaml[detail][host]
24 # results['bugsmaster'] = host == 'rietz.debian.org'
25 # results['qamaster'] = host == 'merkel.debian.org'
26 # results['mailrelay'] = host == 'spohr.debian.org'
27 # results['rtmaster'] = host == 'spohr.debian.org'
28 # results['packagesmaster'] = host == 'powell.debian.org'
30 # nodeinfo['reservedaddrs'] = case host
31 # when "ball.debian.org": "0.0.0.0/8 : 127.0.0.0/8 : 169.254.0.0/16 : \
32 # 172.16.0.0/12 : 192.0.0.0/17 : 192.168.0.0/16 : \
33 # 224.0.0.0/4 : 240.0.0.0/5 : 248.0.0.0/5"
34 # else "0.0.0.0/8 : 127.0.0.0/8 : 10.0.0.0/8 : 169.254.0.0/16 : \
35 # 172.16.0.0/12 : 192.0.0.0/17 : 192.168.0.0/16 : \
36 # 224.0.0.0/4 : 240.0.0.0/5 : 248.0.0.0/5"
39 ldap = LDAP::Conn.new('db.debian.org')
42 filter = '(hostname=' + host +')'
44 ldap.search2('ou=hosts,dc=debian,dc=org', LDAP::LDAP_SCOPE_SUBTREE, filter) do |x|
47 rescue LDAP::ResultError