From 3e2580bdd52ff77eda680edb3578f6eaf2fe41d5 Mon Sep 17 00:00:00 2001 From: Stephen Gran Date: Sun, 8 Nov 2009 14:51:34 +0000 Subject: [PATCH] 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 --- files/etc/puppet/lib/puppet/parser/functions/allnodeinfo.rb | 2 ++ files/etc/puppet/lib/puppet/parser/functions/nodeinfo.rb | 2 ++ 2 files changed, 4 insertions(+) diff --git a/files/etc/puppet/lib/puppet/parser/functions/allnodeinfo.rb b/files/etc/puppet/lib/puppet/parser/functions/allnodeinfo.rb index 4e6a6652..4270343b 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 11d3e7dd..d7f3daea 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 -- 2.39.2