mkrakowitzer / puppet-deploy

Puppet module to deploy compressed files
11 stars 23 forks source link

Added 'onlyif' and 'unless' parameters #14

Open hamidnazari opened 9 years ago

hamidnazari commented 9 years ago

I'm only proposing this fix I quickly put together as a solution to a problem I was facing. This is going to produce different behaviour as I have changed a default value. So, perhaps you would want to tweak it or rewrite it in a more backward-compatible way.

The Problem The first puppet apply worked just fine, but the second run would fail as it tried to uncompress a file that didn't exist anymore. The archive file gets removed at the end of the first run, file.pp:174 exec { "cleanup_${file}":.

Then the second run would not download the package because of file.pp:133 unless => "test -d ${target}",. Clearly the $target now exists from the previous run. After this, the uncompression commands start failing.

Easier Solution Make sure untar and unzip resources also check for existence of $target in their corresponding files.

Better Solution Allow user to decide when the code should ignore the commands and when it should not. In my case, I needed the package redownloaded and reextracted.

Another Possible Nicety Perhaps we can introduce a cache or allow_redownload parameter that check for or ignore existence of the archive file on the system.

mkrakowitzer commented 9 years ago

Thanks for filing this bug report, I have run into this issue before, albeit very infrequently.

I will take a look and see if I can resolve it as per your suggestions.

jpendle commented 9 years ago

I have now also ran into this issue. Do you have any plans to fix this in the immediate future? I get it every time I re-run puppet apply.