-mxregex = Regexp.new('^\d+\s+(.*)\.$')
-ldapall.keys.sort.each do |host|
- ldapall[host]['mXRecord'].each do |mx|
+mxregex = Regexp.new('^\d+\s+(.*?)\.?$')
+scope.lookupvar('site::allnodeinfo').keys.sort.each do |host|
+ next unless scope.lookupvar('site::allnodeinfo')[host]['mXRecord']
+ scope.lookupvar('site::allnodeinfo')[host]['mXRecord'].each do |mx|