diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-12-19 04:57:57 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2006-12-19 04:57:57 +0000 |
| commit | 9f4870637ce57d548d23c0b3330200014327c268 (patch) | |
| tree | b820cfb5a8150dc00d475ffe0cde6316ad210a91 /lib/puppet/parser | |
| parent | dc5f4dc0d01dc2ccb4679afbf3802a7ab0f3c126 (diff) | |
| download | puppet-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')
| -rw-r--r-- | lib/puppet/parser/interpreter.rb | 4 | ||||
| -rw-r--r-- | lib/puppet/parser/resource.rb | 12 | ||||
| -rw-r--r-- | lib/puppet/parser/resource/param.rb | 25 |
3 files changed, 9 insertions, 32 deletions
diff --git a/lib/puppet/parser/interpreter.rb b/lib/puppet/parser/interpreter.rb index 5fe50d144..5144c4970 100644 --- a/lib/puppet/parser/interpreter.rb +++ b/lib/puppet/parser/interpreter.rb @@ -143,7 +143,7 @@ class Puppet::Parser::Interpreter scope.name = "top" scope.type = "main" - scope.host = client + scope.host = client || facts["hostname"] || Facter.value(:hostname) classes = @classes.dup @@ -192,7 +192,7 @@ class Puppet::Parser::Interpreter if Puppet[:storeconfigs] args = { :resources => scope.resources, - :name => client, + :name => scope.host, :facts => facts } unless scope.classlist.empty? diff --git a/lib/puppet/parser/resource.rb b/lib/puppet/parser/resource.rb index 857b5fa39..05e0af4c1 100644 --- a/lib/puppet/parser/resource.rb +++ b/lib/puppet/parser/resource.rb @@ -279,18 +279,8 @@ class Puppet::Parser::Resource end # Either way, now add our parameters - exists = {} - obj.param_names.each do |pn| exists[pn.name] = pn end - @params.each do |name, param| + obj.collection_merge(:param_names, @params) do |name, param| param.to_rails(obj) - exists.delete(name.to_s) if exists.include?(name.to_s) - end - - unless exists.empty? - obj.save - exists.each do |name, param| - obj.param_names.delete(param) - end end return obj 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 |
