adamsb6/s3_file — pull request #22 by JeanMertz (2014-02-09 11:30:19+00:00)
Title: notify "immediately" causes notified resource to run too soon

I noticed that a "notify immediately" action on this resource causes the other resource to run *before* file permissions/ownership are properly set by the `s3_file` resource.

Example:

```ruby
s3_file File.join('/usr/lib/jvm/java-6-openjdk-amd64/', jai_file) do
notifies :run, "execute[install #{jai}]", :immediately
remote_path jai_file
bucket BUCKET
mode '0755'
aws_access_key_id ID
aws_secret_access_key KEY
end

execute "install #{jai}" do
action :nothing
cwd '/usr/lib/jvm/java-6-openjdk-amd64/'
command "./#{jai_file}"
end
```

This will cause:

```
[2014-02-09T10:32:05+00:00] ERROR: execute[install jai_imageio-1_1-lib]
(myapp::app line 37) had an error: Errno::EACCES: Permission denied - ./jai_imageio-1_1-lib-linux-amd64-jdk.bin
```
When removing `:immediately` (delaying the action), it runs normally.

I haven't found the issue yet in this cookbook, though I presume it has something to do with calling the file resource.

What I did notice while looking at this resource, the `file` resource is only called if a file is freshly downloaded. I would expect that resource the run every time, since it involves file ownership, which could change even if the file is present. Also the file resource is capable of figuring out when to run and when not to, so it's safe to run every time this resource is called.