summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLuke Kanies <luke@reductivelabs.com>2010-01-19 23:00:49 -0800
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commitfbd5b0a2d67b28c3e9ab0f161c1bcfa918ee0b6e (patch)
tree7792e0124b1d4e8de643d6515c83347e2145ecc4 /lib
parent3f6c9481ce9ac59fb3a84ab6792543d039ee403f (diff)
downloadpuppet-fbd5b0a2d67b28c3e9ab0f161c1bcfa918ee0b6e.tar.gz
puppet-fbd5b0a2d67b28c3e9ab0f161c1bcfa918ee0b6e.tar.xz
puppet-fbd5b0a2d67b28c3e9ab0f161c1bcfa918ee0b6e.zip
ResourceHarness now doesn't check params with no 'should'
I hadn't been skipping parameters that didn't have a 'should' value set. This almost always resulted in the right behaviour, because most properties correctly just short-circuit to being in sync if the 'should' value is nil, but this encodes it at the harness, which is where it should be. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/transaction/resource_harness.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/puppet/transaction/resource_harness.rb b/lib/puppet/transaction/resource_harness.rb
index 669b0ae98..a7784f344 100644
--- a/lib/puppet/transaction/resource_harness.rb
+++ b/lib/puppet/transaction/resource_harness.rb
@@ -34,8 +34,10 @@ class Puppet::Transaction::ResourceHarness
return [] if ensure_should_be_absent?(current, param)
end
- resource.properties.reject { |p| p.name == :ensure }.find_all do |param|
- param_is_not_insync?(current, param)
+ resource.properties.reject { |p| p.name == :ensure }.reject do |param|
+ param.should.nil?
+ end.reject do |param|
+ param_is_insync?(current, param)
end.collect do |param|
Puppet::Transaction::Change.new(param, current[param.name])
end
@@ -77,7 +79,7 @@ class Puppet::Transaction::ResourceHarness
param.should == :absent
end
- def param_is_not_insync?(current, param)
- ! param.insync?(current[param.name] || :absent)
+ def param_is_insync?(current, param)
+ param.insync?(current[param.name])
end
end