voxpupuli / puppet-archive

Compressed archive file download and extraction with native types/providers for Windows and Unix
https://forge.puppet.com/puppet/archive
Apache License 2.0
60 stars 178 forks source link

checksum_url seemingly ignored #210

Closed LightAxe closed 8 years ago

LightAxe commented 8 years ago

Affected Puppet, Ruby, OS and module versions/distributions

If /tmp/pc.war already exists, nothing happens. If /tmp/pc.war does not already exist, it is downloaded.

What behaviour did you expect instead

If /tmp/pc.war already exists, compare its checksum to the checksum at checksum_url and redownload it if it does not match. If /tmp/pc.war does not exist, download it.

Then validate the local checksum against the remote checksum.

Output log

Let me know if and what log you'd like and I'll grab it!

Any additional information you'd like to impart

The pc.war.md5 file is not being downloaded at all from the web server; I see no mention of it in --debug, and my web server's logs don't mention it being accessed (in either access_log or error_log).

I may be misinterpreting the use of the checksum_url parameter. I'm very open to suggestions and discussion! Ultimately, I need Puppet to recognize when a file on a webserver changes and then update the local copy. I had hoped a simple checksum would solve that problem.

LightAxe commented 8 years ago

I did some more digging/experimenting and think the problem is around line 167 in lib/puppet/type/archive.rb:

  newparam(:checksum_url) do
    desc 'archive file checksum source (instead of specifying checksum)'
  end
  newparam(:digest_url) do
    desc 'archive file checksum source (instead of specifying checksum)
    (this parameter is for camptocamp/archive compatibility)'
    munge do |val|
      resource[:checksum_url] = val
    end
  end

My ruby-foo is very weak, but it looks like the checksum_url parameter is inadvertently ignored?

nanliu commented 8 years ago

No the type is just munging for compatibility so if someone uses camp to camp archive parameters it passes digest_url value to checksum_url. Based on #204 this is a regression introduced by recent changes so maybe a git bisect will help track it down.

LightAxe commented 8 years ago

I changed my parameters to use digest instead of checksum and it is working as expected.

On Tue, Aug 30, 2016 at 20:19 Nan Liu notifications@github.com wrote:

No the type is just munging for compatibility so if someone uses camp to camp archive parameters it passes digest_url value to checksum_url. Based on #204 https://github.com/voxpupuli/puppet-archive/issues/204 this is a regression introduced by recent changes so maybe a git bisect will help track it down.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/voxpupuli/puppet-archive/issues/210#issuecomment-243647331, or mute the thread https://github.com/notifications/unsubscribe-auth/ABwFUIh2J6iDQItRJxUfPa4sPgYAIAcLks5qlPLOgaJpZM4JwtWx .

nanliu commented 8 years ago

@LightAxe, check and see if #211 resolves this issue.

igalic commented 8 years ago

fixed in #211