I think it's better to raise an exception and die rather than silently
authorStephen Gran <steve@lobefin.net>
Sun, 8 Nov 2009 14:51:34 +0000 (14:51 +0000)
committerStephen Gran <steve@lobefin.net>
Sun, 8 Nov 2009 14:51:34 +0000 (14:51 +0000)
continue on with no data.  We'll do that by raising a puppet parse error
exception, which will make the client log the problem.
Signed-off-by: Stephen Gran <steve@lobefin.net>
files/etc/puppet/lib/puppet/parser/functions/allnodeinfo.rb
files/etc/puppet/lib/puppet/parser/functions/nodeinfo.rb

index 4e6a665..4270343 100644 (file)
@@ -14,7 +14,9 @@ module Puppet::Parser::Functions
         results << x
       end
     rescue LDAP::ResultError
+      raise Puppet::ParseError, "LDAP error"
     rescue RuntimeError
+      raise Puppet::ParseError, "No data returned from search"
     ensure
       ldap.unbind
     end
index 11d3e7d..d7f3dae 100644 (file)
@@ -53,7 +53,9 @@ module Puppet::Parser::Functions
         results['ldap'] << x
       end
     rescue LDAP::ResultError
+      raise Puppet::ParseError, "LDAP error"
     rescue RuntimeError
+      raise Puppet::ParseError, "No data returned from search"
     ensure
       ldap.unbind
     end