require '/var/lib/puppet/lib/puppet/parser/functions/ldapinfo.rb'
require '/var/lib/puppet/lib/puppet/parser/functions/whohosts.rb'
- results = function_yamlinfo(host, yamlfile)
- results['ldap'] = function_ldapinfo(host, '*')
- unless results['ldap']['ipHostNumber']
+ nodeinfo = function_yamlinfo(host, yamlfile)
+ nodeinfo['ldap'] = function_ldapinfo(host, '*')
+ unless nodeinfo['ldap']['ipHostNumber']
raise Puppet::ParseError, "Host #{host} does not have ipHostNumber values in ldap"
end
- results['hoster'] = function_whohosts(results['ldap']['ipHostNumber'], "/etc/puppet/modules/debian-org/misc/hoster.yaml")
+ nodeinfo['hoster'] = function_whohosts(nodeinfo['ldap']['ipHostNumber'], "/etc/puppet/modules/debian-org/misc/hoster.yaml")
- results['misc'] = {}
+ nodeinfo['misc'] = {}
fqdn = lookupvar('fqdn')
if fqdn and fqdn == host
v4ips = lookupvar('v4ips')
if v4ips
- results['misc']['v4addrs'] = v4ips.split(',')
+ nodeinfo['misc']['v4addrs'] = v4ips.split(',')
# find out if we are behind nat
- intersection = results['misc']['v4addrs'] & results['ldap']['ipHostNumber']
- results['misc']['natted'] = intersection.empty?
+ intersection = nodeinfo['misc']['v4addrs'] & nodeinfo['ldap']['ipHostNumber']
+ nodeinfo['misc']['natted'] = intersection.empty?
end
v6ips = lookupvar('v6ips')
if v6ips and v6ips != "no"
- results['misc']['v6addrs'] = v6ips.split(',')
+ nodeinfo['misc']['v6addrs'] = v6ips.split(',')
end
end
if not nodeinfo['hoster']['nameservers'] or nodeinfo['hoster']['nameservers'].empty?
# no nameservers known for this hoster
- results['misc']['resolver-recursive'] = true
+ nodeinfo['misc']['resolver-recursive'] = true
elsif (nodeinfo['hoster']['nameservers'] & nodeinfo['misc']['v4addrs']).size > 0 or
(nodeinfo['hoster']['nameservers'] & nodeinfo['misc']['v6addrs']).size > 0
# this host is listed as a nameserver at this location
- results['misc']['resolver-recursive'] = true
+ nodeinfo['misc']['resolver-recursive'] = true
else
- results['misc']['resolver-recursive'] = false
+ nodeinfo['misc']['resolver-recursive'] = false
end
- return(results)
+ return(nodeinfo)
end
end