summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser
diff options
context:
space:
mode:
authorBrice Figureau <brice-puppet@daysofwonder.com>2009-06-06 12:52:25 +0200
committerJames Turnbull <james@lovedthanlost.net>2009-06-11 08:05:36 +1000
commit2945f8d315d265cfb527443cca27d191b7f3d8be (patch)
tree5d451bbac03e553ab70d8c599ab7c48f22a0ba00 /lib/puppet/parser
parente142ca656cb5a44005edc9c9d0c767664768362e (diff)
downloadpuppet-2945f8d315d265cfb527443cca27d191b7f3d8be.tar.gz
puppet-2945f8d315d265cfb527443cca27d191b7f3d8be.tar.xz
puppet-2945f8d315d265cfb527443cca27d191b7f3d8be.zip
Make sure overriding a tag also produces a tag
This is so that overriding the "tag" metaparameter ends-up in the resource tags on the server. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'lib/puppet/parser')
-rw-r--r--lib/puppet/parser/resource.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb
index e7932de84..6632d2bba 100644
--- a/lib/puppet/parser/resource.rb
+++ b/lib/puppet/parser/resource.rb
@@ -139,7 +139,6 @@ class Puppet::Parser::Resource
if params = options[:params]
options.delete(:params)
params.each do |param|
- tag(*param.value) if param.name == :tag
set_parameter(param)
end
end
@@ -204,6 +203,8 @@ class Puppet::Parser::Resource
end
# Define a parameter in our resource.
+ # if we ever receive a parameter named 'tag', set
+ # the resource tags with its value.
def set_parameter(param, value = nil)
if value
param = Puppet::Parser::Resource::Param.new(
@@ -213,6 +214,8 @@ class Puppet::Parser::Resource
raise ArgumentError, "Must pass a parameter or all necessary values"
end
+ tag(*param.value) if param.name == :tag
+
# And store it in our parameter hash.
@params[param.name] = param
end
@@ -327,7 +330,7 @@ class Puppet::Parser::Resource
def override_parameter(param)
# This can happen if the override is defining a new parameter, rather
# than replacing an existing one.
- (@params[param.name] = param and return) unless current = @params[param.name]
+ (set_parameter(param) and return) unless current = @params[param.name]
# The parameter is already set. Fail if they're not allowed to override it.
unless param.source.child_of?(current.source)
@@ -353,7 +356,7 @@ class Puppet::Parser::Resource
# so that the source is registered correctly for later overrides.
param.value = [current.value, param.value].flatten if param.add
- @params[param.name] = param
+ set_parameter(param)
end
# Verify that all passed parameters are valid. This throws an error if