From 377748bbc8dc5824bb518905c0f618b27d5e9ea5 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Tue, 1 Mar 2011 11:07:57 +0100 Subject: [PATCH] Way more painful than is legal --- .../puppetmaster/lib/puppet/parser/functions/whohosts.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/puppetmaster/lib/puppet/parser/functions/whohosts.rb b/modules/puppetmaster/lib/puppet/parser/functions/whohosts.rb index d0321846e..84b618c3e 100644 --- a/modules/puppetmaster/lib/puppet/parser/functions/whohosts.rb +++ b/modules/puppetmaster/lib/puppet/parser/functions/whohosts.rb @@ -17,7 +17,7 @@ module Puppet::Parser::Functions yaml.keys.each do |hoster| if yaml[hoster].kind_of?(Array) netrange = yaml[hoster] - elsif yaml[hoster].kind_of?(Array) and yaml[hoster].has_key?['netrange'] + elsif yaml[hoster].kind_of?(Hash) and yaml[hoster].has_key?('netrange') netrange = yaml[hoster]['netrange'] else next @@ -25,10 +25,10 @@ module Puppet::Parser::Functions netrange.each do |net| begin if IPAddr.new(net).include?(addr) - return hoster + ans = hoster end - rescue - raise "Could not match addr #{addr} for net #{net}" + rescue Exception => e + raise "Error while trying to match addr #{addr} for net #{net}: #{e.message}\n#{e.backtrace}" end end end -- 2.20.1