summaryrefslogtreecommitdiffstats
path: root/lib/puppet/parser/resource/param.rb
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-12-19 04:57:57 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-12-19 04:57:57 +0000
commit9f4870637ce57d548d23c0b3330200014327c268 (patch)
treeb820cfb5a8150dc00d475ffe0cde6316ad210a91 /lib/puppet/parser/resource/param.rb
parentdc5f4dc0d01dc2ccb4679afbf3802a7ab0f3c126 (diff)
downloadpuppet-9f4870637ce57d548d23c0b3330200014327c268.tar.gz
puppet-9f4870637ce57d548d23c0b3330200014327c268.tar.xz
puppet-9f4870637ce57d548d23c0b3330200014327c268.zip
All rails *and* language tests now pass, with the exception of a language/resource test that passes by itself but fails when run as part of the whole suite. Also, I added deletion where appropriate, so that unspecified resources, parameters, and facts are now deleted, as one would expect.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1951 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet/parser/resource/param.rb')
-rw-r--r--lib/puppet/parser/resource/param.rb25
1 files changed, 6 insertions, 19 deletions
diff --git a/lib/puppet/parser/resource/param.rb b/lib/puppet/parser/resource/param.rb
index 6f24f1486..1f7a66aae 100644
--- a/lib/puppet/parser/resource/param.rb
+++ b/lib/puppet/parser/resource/param.rb
@@ -23,31 +23,18 @@ class Puppet::Parser::Resource::Param
# We're creating it anew.
pn = res.param_names.build(:name => self.name.to_s)
end
+
+ value_objects = []
if l = self.line
pn.line = Integer(l)
end
- exists = {}
- pn.param_values.each { |pv| exists[pv.value] = pv }
- values.each do |value|
- unless pn.param_values.find_by_value(value)
- pn.param_values.build(:value => value)
- end
- # Mark that this is still valid.
- if exists.include?(value)
- exists.delete(value)
- end
- end
-
- # And remove any existing values that are not in the current value list.
- unless exists.empty?
- # We have to save the current state else the deletion somehow deletes
- # our new values.
- pn.save
- exists.each do |value, obj|
- pn.param_values.delete(obj)
+ pn.collection_merge(:param_values, values) do |value|
+ unless pv = pn.param_values.find_by_value(value)
+ pv = pn.param_values.build(:value => value)
end
+ pv
end
return pn