summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/scope.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser/scope.rb')
-rw-r--r--lib/puppet/parser/scope.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/puppet/parser/scope.rb b/lib/puppet/parser/scope.rb
index 1dde7f642..f247bd7b8 100644
--- a/lib/puppet/parser/scope.rb
+++ b/lib/puppet/parser/scope.rb
@@ -35,6 +35,20 @@ module Puppet
@@declarative = val
end
+ # Add all of the defaults for a given object to that object.
+ def adddefaults(obj)
+ defaults = self.lookupdefaults(obj.type)
+
+ defaults.each do |var, value|
+ unless obj[var]
+ self.debug "Adding default %s for %s" %
+ [var, obj.type]
+
+ obj[var] = value
+ end
+ end
+ end
+
# Add a single object's tags to the global list of tags for
# that object.
def addtags(obj)
@@ -975,6 +989,9 @@ module Puppet
# probably should not matter
child.tags = self.tags
+ # Add any defaults.
+ self.adddefaults(child)
+
# Then make sure this child's tags are stored in the
# central table. This should maybe be in the evaluate
# methods, but, eh.