X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=files%2Fetc%2Fpuppet%2Flib%2Fpuppet%2Fparser%2Ffunctions%2Fnodeinfo.rb;h=5223752075aa3372d5150eab079ad26f10a0f21f;hb=a6c3c9080b7a696d74bd5e37ea372fd2972db96e;hp=db16133ae74aff928f0af96e9e7c779a357d0806;hpb=e73743d9798dd28bef9565e667300745209b403a;p=mirror%2Fdsa-puppet.git diff --git a/files/etc/puppet/lib/puppet/parser/functions/nodeinfo.rb b/files/etc/puppet/lib/puppet/parser/functions/nodeinfo.rb index db16133ae..522375207 100644 --- a/files/etc/puppet/lib/puppet/parser/functions/nodeinfo.rb +++ b/files/etc/puppet/lib/puppet/parser/functions/nodeinfo.rb @@ -21,19 +21,31 @@ module Puppet::Parser::Functions end end - ldap = LDAP::Conn.new('samosa.debian.org') + if yaml.has_key?('services') + yaml['services'].each_pair do |service, hostlist| + hostlist=[hostlist] unless hostlist.kind_of?(Array) + results[service] = hostlist.include?(host) + end + end + + results['mail_port'] = '' + results['smarthost'] = '' + results['heavy_exim'] = '' + results['smarthost_port'] = 587 + results['reservedaddrs'] = '0.0.0.0/8 : 127.0.0.0/8 : 10.0.0.0/8 : 169.254.0.0/16 : 172.16.0.0/12 : 192.0.0.0/17 : 192.168.0.0/16 : 224.0.0.0/4 : 240.0.0.0/5 : 248.0.0.0/5' - results['ldap'] = [] - filter = '(hostname=' + host +')' - begin - ldap.search2('ou=hosts,dc=debian,dc=org', LDAP::LDAP_SCOPE_SUBTREE, filter) do |x| - results['ldap'] << x + if yaml['host_settings'].kind_of?(Hash) + yaml['host_settings'].each_pair do |property, values| + if values.kind_of?(Hash) + results[property] = values[host] if values.has_key?(host) + elsif values.kind_of?(Array) + results[property] = "true" if values.include?(host) + end end - rescue LDAP::ResultError - rescue RuntimeError - ensure - ldap.unbind end - return(results) + + results['ldap'] = ldapinfo(host, '*') end end + +# vim: set fdm=marker ts=2 sw=2 et: