diff options
-rw-r--r-- | CHANGELOG | 2 | ||||
-rw-r--r-- | lib/puppet/parser/interpreter.rb | 2 | ||||
-rwxr-xr-x | test/language/interpreter.rb | 12 |
3 files changed, 15 insertions, 1 deletions
@@ -1,3 +1,5 @@ + External node sources can now return undefined classes (#687). + Puppet clients now have http proxy support (#701). The parser now throws an error when a resource reference diff --git a/lib/puppet/parser/interpreter.rb b/lib/puppet/parser/interpreter.rb index 11f5aa15d..bdb49da4c 100644 --- a/lib/puppet/parser/interpreter.rb +++ b/lib/puppet/parser/interpreter.rb @@ -28,7 +28,7 @@ class Puppet::Parser::Interpreter # Then evaluate the classes. begin - options[:scope].function_include(classes) + options[:scope].function_include(classes.find_all { |c| options[:scope].findclass(c) }) rescue => detail raise Puppet::ParseError, "Could not evaluate classes for %s: %s" % [name, detail] end diff --git a/test/language/interpreter.rb b/test/language/interpreter.rb index 1eeb65b1a..302c7e336 100755 --- a/test/language/interpreter.rb +++ b/test/language/interpreter.rb @@ -853,6 +853,18 @@ class TestInterpreter < PuppetTest::TestCase assert(scope.classlist.include?("sub"), "NodeDef did not evaluate class") assert(scope.classlist.include?("other"), "NodeDef did not evaluate other class") + + # Now make sure nodedef doesn't fail when some classes are not defined (#687). + assert_nothing_raised("Could not create a node definition with some invalid classes") do + node = NodeDef.new :name => "yay", :classes => %w{base unknown} + end + + scope = mkscope :interp => interp + assert_nothing_raised("Could not evaluate the node definition with some invalid classes") do + node.evaluate(:scope => scope) + end + + assert(scope.classlist.include?("base"), "NodeDef did not evaluate class") end # This can stay in the main test suite because it doesn't actually use ldapsearch, |