diff options
author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-05-14 15:19:48 +0000 |
---|---|---|
committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-05-14 15:19:48 +0000 |
commit | 27cabf25fc08ee77df08ec65a440f9d164b9215d (patch) | |
tree | 558ae2a8d0709c75c53601afa1021125dc9d4950 /lib/puppet/parser/ast/hostclass.rb | |
parent | 613c413cd84a690f1fb0cb625380e430bc502c84 (diff) | |
download | puppet-27cabf25fc08ee77df08ec65a440f9d164b9215d.tar.gz puppet-27cabf25fc08ee77df08ec65a440f9d164b9215d.tar.xz puppet-27cabf25fc08ee77df08ec65a440f9d164b9215d.zip |
Fixing a weird bug that occurred because I was changing @parentclass in the AST stuff the first time it was called, from a string to a the actual instance of the parent. This worked fine as long as the parentclass was only called when parsing was complete, such as during evaluation, but if anything resulted in it being called earlier (e.g., attempting to add to the class during parsing), then things behaved, um, badly. This commit fixes the method so that the variable is not modified; there is now @parentclass and @parentobj.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2511 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/parser/ast/hostclass.rb')
-rw-r--r-- | lib/puppet/parser/ast/hostclass.rb | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/lib/puppet/parser/ast/hostclass.rb b/lib/puppet/parser/ast/hostclass.rb index 526265c1c..5416c1071 100644 --- a/lib/puppet/parser/ast/hostclass.rb +++ b/lib/puppet/parser/ast/hostclass.rb @@ -12,10 +12,10 @@ class Puppet::Parser::AST def child_of?(klass) return false unless self.parentclass - if klass == self.parentclass + if klass == self.parentobj return true else - return self.parentclass.child_of?(klass) + return self.parentobj.child_of?(klass) end end @@ -31,15 +31,11 @@ class Puppet::Parser::AST end pnames = nil - if @parentclass - if pklass = self.parentclass - pklass.safeevaluate :scope => scope + if pklass = self.parentobj + pklass.safeevaluate :scope => scope - scope = parent_scope(scope, pklass) - pnames = scope.namespaces - else - parsefail "Could not find class %s" % @parentclass - end + scope = parent_scope(scope, pklass) + pnames = scope.namespaces end unless hash[:nosubscope] |