Bug #12221

pkgdmg provider deletes files regardless of source

Added by Simon Hildrew 4 months ago. Updated 4 months ago.

Status:Requires CLA to be signed Start date:01/27/2012
Priority:Normal Due date:
Assignee:Gary Larizza % Done:

0%

Category:package
Target version:2.7.x
Affected Puppet version:2.7.9 Branch:
Keywords:
Votes: 0

Description

The pkgdmg provider cleans up files at the end of execution. This is sane when the file is temporary (e.g. downloaded from an http URI) but not when using a file on an NFS mount or other local filesystem.

The error that appears is as follows: err: /Stage[main]//Package[TeamCity]/ensure: change from absent to present failed: Could not set ‘present on ensure: Permission denied – /osx/teamcity/TeamCity-6.5.3.pkg at /private/var/root/test.pp:5

The permission denied is the provider attempting to delete the file from read only NFS.

Despite the error the package is installed correctly and not installed on subsequent runs (the cookie check passes). On an initial run however, dependencies are not satisfied.

Having looked at the code I believe that the unlink on pkgdmg.rb:106 should only be attempted if source != cached_source (i.e. a temporary file is being used). This works for me and I believe is right but I haven’t tested this with URI sources.

Workaround is to only use URI sources.

pkgdmg_provider_deletes_files_only_on_URI.patch - Suggested patch (569 Bytes) Simon Hildrew, 01/27/2012 03:32 am

History

Updated by Daniel Pittman 4 months ago

  • Category set to package
  • Status changed from Unreviewed to Requires CLA to be signed
  • Assignee set to Gary Larizza
  • Target version set to 2.7.x

Simon Hildrew wrote:

The pkgdmg provider cleans up files at the end of execution. This is sane when the file is temporary (e.g. downloaded from an http URI) but not when using a file on an NFS mount or other local filesystem. […] Having looked at the code I believe that the unlink on pkgdmg.rb:106 should only be attempted if source != cached_source (i.e. a temporary file is being used). This works for me and I believe is right but I haven’t tested this with URI sources.

That looks sane to me, but I want Gary Larizza, one of our mac experts, to take a quick look and confirm for me.

Meanwhile, Simon, we need you to sign a CLA; the link is in our “contributing” documentation here: https://github.com/puppetlabs/puppet/blob/master/CONTRIBUTING.md

It would be nice if you could make this a pull request, etc, but just getting the CLA done is enough that we can take the code. Thanks.

Also available in: Atom PDF