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/component.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/component.rb')
-rw-r--r-- | lib/puppet/parser/ast/component.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/puppet/parser/ast/component.rb b/lib/puppet/parser/ast/component.rb index 6a309ac8c..a3d1fb026 100644 --- a/lib/puppet/parser/ast/component.rb +++ b/lib/puppet/parser/ast/component.rb @@ -21,6 +21,8 @@ class Puppet::Parser::AST # These are retrieved when looking up the superclass attr_accessor :name + attr_reader :parentclass + def child_of?(klass) false end @@ -132,10 +134,8 @@ class Puppet::Parser::AST end end - def parentclass - parentobj do |name| - @interp.findclass(namespace, name) - end + def find_parentclass + @interp.findclass(namespace, parentclass) end # Set our parent class, with a little check to avoid some potential @@ -152,8 +152,8 @@ class Puppet::Parser::AST def parentobj if @parentclass # Cache our result, since it should never change. - unless @parentclass.is_a?(AST::HostClass) - unless tmp = yield(@parentclass) + unless defined?(@parentobj) + unless tmp = find_parentclass parsefail "Could not find %s %s" % [self.class.name, @parentclass] end @@ -161,9 +161,9 @@ class Puppet::Parser::AST parsefail "Parent classes must have dissimilar names" end - @parentclass = tmp + @parentobj = tmp end - @parentclass + @parentobj else nil end |