summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Helwig <jacob@puppetlabs.com>2011-02-01 14:37:34 -0800
committerJacob Helwig <jacob@puppetlabs.com>2011-02-01 14:37:34 -0800
commit6c93eb2c142e346077c49ef78a5fcf675eeb2698 (patch)
treed209699fce5781205c7ab9e86fa646eba3e4d26a
parentf135a6436084629d47c6b3b590dadb14952e4d69 (diff)
downloadpuppet-6c93eb2c142e346077c49ef78a5fcf675eeb2698.tar.gz
puppet-6c93eb2c142e346077c49ef78a5fcf675eeb2698.tar.xz
puppet-6c93eb2c142e346077c49ef78a5fcf675eeb2698.zip
Remove order dependency when specifying source and checksum on File type
If source was specified after setting the checksum, it would cause the checksum to be set back to :md5. This was completely unnecessary, because the checksum has its own default of :md5. Paired-with: Jesse Wolfe <jesse@puppetlabs.com>
-rwxr-xr-xlib/puppet/type/file/source.rb1
-rwxr-xr-xspec/unit/type/file_spec.rb15
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/puppet/type/file/source.rb b/lib/puppet/type/file/source.rb
index 7d03de2b0..bc464e1c3 100755
--- a/lib/puppet/type/file/source.rb
+++ b/lib/puppet/type/file/source.rb
@@ -169,7 +169,6 @@ module Puppet
checks.delete(:checksum)
resource[:audit] = checks
- resource[:checksum] = :md5 unless resource.property(:checksum)
end
def local?
diff --git a/spec/unit/type/file_spec.rb b/spec/unit/type/file_spec.rb
index db0fa9f34..944bd6bac 100755
--- a/spec/unit/type/file_spec.rb
+++ b/spec/unit/type/file_spec.rb
@@ -1096,4 +1096,19 @@ describe Puppet::Type.type(:file) do
File.exists?(@path).should == true
end
end
+
+ describe "when specifying both source and checksum" do
+ it 'should use the specified checksum when source is first' do
+ @file[:source] = '/foo'
+ @file[:checksum] = :md5lite
+
+ @file[:checksum].should be :md5lite
+ end
+ it 'should use the specified checksum when source is last' do
+ @file[:checksum] = :md5lite
+ @file[:source] = '/foo'
+
+ @file[:checksum].should be :md5lite
+ end
+ end
end