summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2009-06-11 18:35:14 -0500
committerLuke Kanies <luke@madstop.com>2009-06-11 18:35:14 -0500
commite4ae870f6103aacbba48a06e366168aaaa67402b (patch)
tree879e195375b9935ad7cbf8956804f2d1d63cd406 /lib/puppet/parser
parent607b01e82ea294068fdd554e59bc8e5fe3f9761a (diff)
downloadpuppet-e4ae870f6103aacbba48a06e366168aaaa67402b.tar.gz
puppet-e4ae870f6103aacbba48a06e366168aaaa67402b.tar.xz
puppet-e4ae870f6103aacbba48a06e366168aaaa67402b.zip
Fixing #2336 - qualified variables only throw warnings
We were previously throwing exceptions. This also ports all of the tests for variable lookup over to rspec. Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r--lib/puppet/parser/scope.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb
index 0a182fe1d..bf34d2e29 100644
--- a/lib/puppet/parser/scope.rb
+++ b/lib/puppet/parser/scope.rb
@@ -174,10 +174,12 @@ class Puppet::Parser::Scope
klassname = parts.join("::")
klass = findclass(klassname)
unless klass
- raise Puppet::ParseError, "Could not find class %s" % klassname
+ warning "Could not look up qualified variable '%s'; class %s could not be found" % [name, klassname]
+ return usestring ? "" : :undefined
end
unless kscope = compiler.class_scope(klass)
- raise Puppet::ParseError, "Class %s has not been evaluated so its variables cannot be referenced" % klass.classname
+ warning "Could not look up qualified variable '%s'; class %s has not been evaluated" % [name, klassname]
+ return usestring ? "" : :undefined
end
return kscope.lookupvar(shortname, usestring)
end