criteo-cookbooks/nssm

When using a before notification Remote_file in install freaks out

Closed this issue · 5 comments

because the zip file hasn't been extracted yet while checking to run the before notification the resource freaks out and crashes the chef run.

Need to add a test to catch this and also apply the fix which is adding the following line to the remote_file resource:

only_if {::File.exist?("#{Chef::Config[:file_cache_path]}/#{basename}/#{system}/nssm.exe")}

will make the change as soon as i'm done some more local testing.

Annih commented

Could describe the error and the setup that triggers it?
i.e. please provide a sample recipe to reproduce + the error message :)

just add a before notification to an NSSM resource and you will trigger the error. this is a remaining bug that was not fixed or merged when the PR to fix the zip functionality was merged. I just finally got around to fixing it since no one else had a chance. It was an issue I opened up as a reminder to fix the bug.

Annih commented

I'm sorry @axelrtgs I'm not having difficulties to reproduce with a simple before notification/subscription.
Here is the code I used:

log 'before notification' do
  notifies :install, 'nssm_install[Install NSSM]', :before
end
log 'before subscription' do
  action :nothing
  subscribes :write, 'nssm_install[Install NSSM]', :before
end
include_recipe 'nssm'

I used Chef 12.18.31, the only bug I encountered was with the rubyzip gem, but your fix didn't help. I'm sure you have a different setup. Could you share it with me?

Just wanted to follow up on this to see if you need more information in case i wasn't clear on some aspect.
Thanks for your time,