From b8920939ade4d9956a7f3b2ba3a2c77a3f788c58 Mon Sep 17 00:00:00 2001 From: luke Date: Thu, 5 Oct 2006 20:47:20 +0000 Subject: Fixing weird case where the default node is in one node source and the real node is in a different one git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1734 980ebf18-57e1-0310-9a29-db15c13687c0 --- lib/puppet/parser/interpreter.rb | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'lib/puppet/parser') diff --git a/lib/puppet/parser/interpreter.rb b/lib/puppet/parser/interpreter.rb index 60e449db6..787fd8838 100644 --- a/lib/puppet/parser/interpreter.rb +++ b/lib/puppet/parser/interpreter.rb @@ -307,7 +307,7 @@ class Puppet::Parser::Interpreter end # By default, we only search for parsed nodes. - @nodesources = [:code] + @nodesources = [] if Puppet[:ldapnodes] # Nodes in the file override nodes in ldap. @@ -327,6 +327,10 @@ class Puppet::Parser::Interpreter end end + unless @nodesources.include?(:code) + @nodesources << :code + end + @setup = false initparsevars() @@ -584,18 +588,20 @@ class Puppet::Parser::Interpreter nsource = obj.file || source Puppet.info "Found %s in %s" % [node, nsource] return obj - else - # Look for a default node. - if defobj = self.send(method, "default") - Puppet.info "Found default node for %s in %s" % - [node, source] - return defobj - end end end end end + # If they made it this far, we haven't found anything, so look for a + # default node. + unless nodes.include?("default") + if defobj = self.nodesearch("default") + Puppet.notice "Using default node for %s" % [nodes[0]] + return defobj + end + end + return nil end -- cgit