diff options
Diffstat (limited to 'lib/puppet/parser/scope.rb')
-rw-r--r-- | lib/puppet/parser/scope.rb | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb index 2f4917bee..c67825bb3 100644 --- a/lib/puppet/parser/scope.rb +++ b/lib/puppet/parser/scope.rb @@ -17,7 +17,7 @@ class Puppet::Parser::Scope include Puppet::Util::Errors attr_accessor :parent, :level, :interp, :source, :host attr_accessor :name, :type, :topscope, :base, :keyword - attr_accessor :top, :translated, :exported + attr_accessor :top, :translated, :exported, :virtual # Whether we behave declaratively. Note that it's a class variable, # so all scopes behave the same. @@ -371,9 +371,7 @@ class Puppet::Parser::Scope return values end - # Look up all of the exported objects of a given type. Just like - # lookupobject, this only searches up through parent classes, not - # the whole scope tree. + # Look up all of the exported objects of a given type. def lookupexported(type) @definedtable.find_all do |name, r| r.type == type and r.exported? @@ -492,6 +490,13 @@ class Puppet::Parser::Scope @children << obj + # Mark the resource as virtual or exported, as necessary. + if self.exported? + obj.exported = true + elsif self.virtual? + obj.virtual = true + end + # The global table @definedtable[obj.ref] = obj @@ -717,6 +722,10 @@ class Puppet::Parser::Scope return ary end end + + def virtual? + self.virtual || self.exported? + end end # $Id$ |