if (nodeinfo['ldap'].has_key?('ipHostNumber'))
nodeinfo['ldap']['ipHostNumber'].each do |addr|
yaml.keys.each do |hoster|
- yaml[hoster].each do |net|
- if IPAddr.new(net).include?(addr)
- ans = hoster
- end
+ if yaml[hoster].kind_of?(Array)
+ netrange = yaml[hoster]
+ elsif yaml[hoster].kind_of?(Array) and yaml[hoster].has_key?['netrange']
+ netrange = yaml[hoster]['netrange']
+ else
+ next
+ end
+ netrange.each do |net|
+ if IPAddr.new(net).include?(addr)
+ return hoster
end
end
end
return ans
end
end
+# vim:set ts=2:
+# vim:set et:
+# vim:set shiftwidth=2: