summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-01-01 23:20:52 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2007-01-01 23:20:52 +0000
commit0887fcdac1d2973f49de7022e1cc1882295d4aa3 (patch)
tree12812e1b95accbcb24f5c73ebd12ab990ea811a9 /lib
parent56619d573bd2da90d798f35b290c4538ec3e1ffe (diff)
downloadpuppet-0887fcdac1d2973f49de7022e1cc1882295d4aa3.tar.gz
puppet-0887fcdac1d2973f49de7022e1cc1882295d4aa3.tar.xz
puppet-0887fcdac1d2973f49de7022e1cc1882295d4aa3.zip
Modifying the "Resource#set" method to simplifying adding new parameters
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2013 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/parser/resource.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb
index 64c4e1bb9..4a1b2d12a 100644
--- a/lib/puppet/parser/resource.rb
+++ b/lib/puppet/parser/resource.rb
@@ -206,7 +206,14 @@ class Puppet::Parser::Resource
end
# You have to pass a Resource::Param to this.
- def set(param)
+ def set(param, value = nil, source = nil)
+ if value and source
+ param = Puppet::Parser::Resource::Param.new(
+ :name => param, :value => value, :source => source
+ )
+ elsif ! param.is_a?(Puppet::Parser::Resource::Param)
+ raise ArgumentError, "Must pass a parameter or all necessary values"
+ end
# Because definitions are now parse-time, I can paramcheck immediately.
paramcheck(param.name)