From: Stephen Gran Date: Sun, 8 Nov 2009 14:51:34 +0000 (+0000) Subject: I think it's better to raise an exception and die rather than silently X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=3e2580bdd52ff77eda680edb3578f6eaf2fe41d5;p=mirror%2Fdsa-puppet.git I think it's better to raise an exception and die rather than silently 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 --- diff --git a/files/etc/puppet/lib/puppet/parser/functions/allnodeinfo.rb b/files/etc/puppet/lib/puppet/parser/functions/allnodeinfo.rb index 4e6a6652b..4270343b1 100644 --- a/files/etc/puppet/lib/puppet/parser/functions/allnodeinfo.rb +++ b/files/etc/puppet/lib/puppet/parser/functions/allnodeinfo.rb @@ -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 diff --git a/files/etc/puppet/lib/puppet/parser/functions/nodeinfo.rb b/files/etc/puppet/lib/puppet/parser/functions/nodeinfo.rb index 11d3e7dd2..d7f3daea7 100644 --- a/files/etc/puppet/lib/puppet/parser/functions/nodeinfo.rb +++ b/files/etc/puppet/lib/puppet/parser/functions/nodeinfo.rb @@ -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