Bug #1642

forcing to md5 warning always shown, even if already set

Added by Bart Cortooms over 3 years ago. Updated over 3 years ago.

Status:Closed Start date:10/09/2008
Priority:Normal Due date:
Assignee:Paul Nasrat % Done:

0%

Category:-
Target version:0.24.6
Affected Puppet version: Branch:
Keywords:
Votes: 0

Description

Since http://projects.reductivelabs.com/repositories/revision/puppet/e6698c2b8624fe2c2bbeef594318e3e8d932d345 the client always shows a warning about forcing the checksum to md5 when source has been set, even when the checksum has already (implicitly or explicitly) been set to md5:

$ cat test.pp 
#!/usr/bin/env puppet

file { "/tmp/target":
    source => "file:///tmp/source",
    checksum => "md5",
}
$ ./test.pp 
warning: //File[/tmp/target]/checksum: Files with source set must use md5 as checksum. Forcing to md5 from md5 for /tmp/target
warning: //File[/tmp/target]/checksum: Files with source set must use md5 as checksum. Forcing to md5 from md5 for /tmp/target

This seems to fix it:

--- puppet/type/file/checksum.rb.old    2008-10-09 19:40:28.000000000 +0200
+++ puppet/type/file/checksum.rb    2008-10-09 19:40:15.000000000 +0200
@@ -53,7 +53,7 @@
         else
             if FileTest.directory?(@resource[:path])
                 return :time
-            elsif @resource[:source]
+            elsif @resource[:source] and not %w{md5 md5lite}.include?(value.to_s)
                 self.warning("Files with source set must use md5 as checksum. Forcing to md5 from %s for %s" % [ value, @resource[:path] ])
                 return :md5
             else

I’m assuming md5lite is also valid, but I’m not sure.

History

Updated by James Turnbull over 3 years ago

  • Status changed from Unreviewed to Needs Decision
  • Assignee set to Luke Kanies

Updated by Luke Kanies over 3 years ago

  • Status changed from Needs Decision to Accepted
  • Assignee changed from Luke Kanies to Paul Nasrat

What’s the design decision to be made? This is definitely a bug.

Paul did the original work, so hopefully he can fix this.

Updated by Paul Nasrat over 3 years ago

luke wrote:

What’s the design decision to be made? This is definitely a bug.

Paul did the original work, so hopefully he can fix this.

I’ll look into this – at initial glance it looks as if it’s a case of me missing the test path of if it’s set already – me assuming the sad-path, the patch looks correct, but I’d like to also write a test for the sad case asserting we warn, and not for the happy-path.

Just FYI I’ll be able to look at this sometime this w/e or Monday.

Updated by James Turnbull over 3 years ago

The design decision was that he submitted a patch – I wanted to know if you were happy with that. :)

Updated by Paul Nasrat over 3 years ago

jamtur01 wrote:

The design decision was that he submitted a patch – I wanted to know if you were happy with that. :)

The patch fixes it based on eyeballing it but the tests could be done better, one for file with source with checksum set to md5 one without. I probably should write tests for the whole of file/type/checksum.rb.

Apologies.

Updated by Paul Nasrat over 3 years ago

  • Status changed from Accepted to In Topic Branch Pending Review

Pushed to github on tickets/0.24.x/1642

md5lite isn’t valid due to the fact we don’t pass checksum type over the wire to the server so suffers the same problem.

Updated by Paul Nasrat over 3 years ago

Just for ease of reference:

git pull git://github.com/pnasrat/puppet.git tickets/0.24.x/1642

Updated by Bart Cortooms over 3 years ago

Thanks, tested the patch from tickets/0.24.x/1642 and it works for me

Updated by James Turnbull over 3 years ago

  • Status changed from In Topic Branch Pending Review to Closed

Pushed in commit:157c0ddff032bb78838a1448eb1ff989bf1da705 in branch 0.24.x

Also available in: Atom PDF