summaryrefslogtreecommitdiffstats
path: root/lib/puppet/resource
diff options
context:
space:
mode:
authorLuke Kanies <luke@puppetlabs.com>2010-05-17 12:22:31 -0700
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commit89e8745e8c5c69775f8e1f680dceb39ba7a985ee (patch)
treef754cfb46dc8b4da9ec67c2369dd41f4135d9bc1 /lib/puppet/resource
parentedcf4297628c704787ff2e7310271d9ccc019816 (diff)
downloadpuppet-89e8745e8c5c69775f8e1f680dceb39ba7a985ee.tar.gz
puppet-89e8745e8c5c69775f8e1f680dceb39ba7a985ee.tar.xz
puppet-89e8745e8c5c69775f8e1f680dceb39ba7a985ee.zip
Fixing #2655 - Adding default parameter values to resources
We were previously just adding these values as variables in the local scope, but we now add them to the resources so they get passed to the client in the catalog and are thus inspectable. Signed-off-by: Luke Kanies <luke@puppetlabs.com>
Diffstat (limited to 'lib/puppet/resource')
-rw-r--r--lib/puppet/resource/type.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/puppet/resource/type.rb b/lib/puppet/resource/type.rb
index 3657f89b5..627a1d5a2 100644
--- a/lib/puppet/resource/type.rb
+++ b/lib/puppet/resource/type.rb
@@ -204,7 +204,11 @@ class Puppet::Resource::Type
# Even if 'default' is a false value, it's an AST value, so this works fine
fail Puppet::ParseError, "Must pass #{param} to #{resource.ref}" unless default
- scope.setvar(param.to_s, default.safeevaluate(scope))
+ value = default.safeevaluate(scope)
+ scope.setvar(param.to_s, value)
+
+ # Set it in the resource, too, so the value makes it to the client.
+ resource[param] = value
end
scope.setvar("title", resource.title) unless set.include? :title