1
require 'puppet/parser/ast/resourcedef'
3
class Puppet::Parser::AST
4
# Set a parameter on a resource specification created somewhere else in the
5
# configuration. The object is responsible for verifying that this is allowed.
6
class ResourceOverride < ResourceDef
10
# Iterate across all of our children.
12
[@object,@params].flatten.each { |param|
13
#Puppet.debug("yielding param %s" % param)
18
# Does not actually return an object; instead sets an object
19
# in the current scope.
23
# Get our object reference.
24
object = @object.safeevaluate(:scope => scope)
28
# Evaluate all of the specified params.
29
params = @params.collect { |param|
30
param.safeevaluate(:scope => scope)
33
# Now we just create a normal resource, but we call a very different
34
# method on the scope.
35
obj = Puppet::Parser::Resource.new(
37
:title => object.title,
41
:source => scope.source,
45
# Now we tell the scope that it's an override, and it behaves as
47
scope.setoverride(obj)
52
# Create our ResourceDef. Handles type checking for us.
57
#self.typecheck(@type.value)
62
# $Id: resourceoverride.rb 1726 2006-10-04 18:24:24Z luke $