summaryrefslogtreecommitdiffstats
path: root/lib/puppet/resource.rb
diff options
context:
space:
mode:
authorLuke Kanies <luke@reductivelabs.com>2010-01-21 22:00:10 -0800
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commitc8e89cc1a69ff5827ad40439a2c903c24ae42aba (patch)
treedafcbf3de176245cf4728b5a7c54bca4ea8e5e42 /lib/puppet/resource.rb
parentb7ea1806703df2976d5cd6fade5503c008332526 (diff)
downloadpuppet-c8e89cc1a69ff5827ad40439a2c903c24ae42aba.tar.gz
puppet-c8e89cc1a69ff5827ad40439a2c903c24ae42aba.tar.xz
puppet-c8e89cc1a69ff5827ad40439a2c903c24ae42aba.zip
Changing the interface of Puppet::Resource
We need the ability to set the namespace and environment at initialization so the resource can look up qualified types. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
Diffstat (limited to 'lib/puppet/resource.rb')
-rw-r--r--lib/puppet/resource.rb12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/puppet/resource.rb b/lib/puppet/resource.rb
index bdd11fcc5..e47501791 100644
--- a/lib/puppet/resource.rb
+++ b/lib/puppet/resource.rb
@@ -116,14 +116,20 @@ class Puppet::Resource
end
# Create our resource.
- def initialize(type, title, parameters = {})
- @reference = Puppet::Resource::Reference.new(type, title)
+ def initialize(type, title, attributes = {})
@parameters = {}
- parameters.each do |param, value|
+ (attributes[:parameters] || {}).each do |param, value|
self[param] = value
end
+ attributes.each do |attr, value|
+ next if attr == :parameters
+ send(attr.to_s + "=", value)
+ end
+
+ @reference = Puppet::Resource::Reference.new(type, title)
+
tag(@reference.type)
tag(@reference.title) if valid_tag?(@reference.title)
end