summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/ast/hostclass.rb
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-02-22 12:10:19 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-02-22 12:10:19 +0000
commitfa02d67a9de63e457b122ccedf4fb329ee04949b (patch)
tree435176b0f24fd80a762c8da46fdbbe548a33f74c /lib/puppet/parser/ast/hostclass.rb
parentd145aae53ddf43de1a5140ce9226e1b2f383376f (diff)
downloadpuppet-fa02d67a9de63e457b122ccedf4fb329ee04949b.tar.gz
puppet-fa02d67a9de63e457b122ccedf4fb329ee04949b.tar.xz
puppet-fa02d67a9de63e457b122ccedf4fb329ee04949b.zip
Fixing #472. Apparently this has been broken since I did the parser redesign. I had to fix the scope trees so that subclass scopes are subscopes of the parent scopes, which used to be the case but was far more complicated.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2220 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/parser/ast/hostclass.rb')
-rw-r--r--lib/puppet/parser/ast/hostclass.rb18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/puppet/parser/ast/hostclass.rb b/lib/puppet/parser/ast/hostclass.rb
index 4a4664f0f..65dd27542 100644
--- a/lib/puppet/parser/ast/hostclass.rb
+++ b/lib/puppet/parser/ast/hostclass.rb
@@ -33,19 +33,21 @@ class Puppet::Parser::AST
if @parentclass
if pklass = self.parentclass
pklass.safeevaluate :scope => scope
+
+ scope = parent_scope(scope, pklass)
else
parsefail "Could not find class %s" % @parentclass
end
end
- # Set the class before we do anything else, so that it's set
- # during the evaluation and can be inspected.
- scope.setclass(self)
-
unless hash[:nosubscope]
scope = subscope(scope)
end
+ # Set the class before we do anything else, so that it's set
+ # during the evaluation and can be inspected.
+ scope.setclass(self)
+
# Now evaluate our code, yo.
if self.code
return self.code.evaluate(:scope => scope)
@@ -58,6 +60,14 @@ class Puppet::Parser::AST
@parentclass = nil
super
end
+
+ def parent_scope(scope, klass)
+ if s = scope.class_scope(klass)
+ return s
+ else
+ raise Puppet::DevError, "Could not find scope for %s" % klass.fqname
+ end
+ end
end
end