[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35
test branch
puppet-dev at googlegroups.com
Wed Jul 14 10:31:00 UTC 2010
The following commit has been merged in the upstream branch:
commit fbd5b0a2d67b28c3e9ab0f161c1bcfa918ee0b6e
Author: Luke Kanies <luke at reductivelabs.com>
Date: Tue Jan 19 23:00:49 2010 -0800
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 at reductivelabs.com>
diff --git a/lib/puppet/transaction/resource_harness.rb b/lib/puppet/transaction/resource_harness.rb
index 669b0ae..a7784f3 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
diff --git a/spec/unit/transaction/resource_harness.rb b/spec/unit/transaction/resource_harness.rb
index d6a36db..2051b2c 100755
--- a/spec/unit/transaction/resource_harness.rb
+++ b/spec/unit/transaction/resource_harness.rb
@@ -113,6 +113,15 @@ describe Puppet::Transaction::ResourceHarness do
@harness.changes_to_perform(@status, @resource)[0].should equal(change)
end
+ it "should not attempt to manage properties that do not have desired values set" do
+ mode = @resource.newattr(:mode)
+ @current_state[:mode] = :absent
+
+ mode.expects(:insync?).never
+
+ @harness.changes_to_perform(@status, @resource)
+ end
+
describe "and the 'ensure' parameter is present but not in sync" do
it "should return a single change for the 'ensure' parameter" do
@resource[:ensure] = :present
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list