I'm having an issue with determining if a package was installed or was already installed using chef's chocolatey_package functionality. Pretty much, I'm installing a package that requires an iisreset afterwards. I only want iis to be reset when the package is installed and NOT on subsequent executions of chef-client (where chocolatey will exit early because the package was already installed).
I am storing what packages are being installed in an attributes file. It uses the following format:
{'name'=>'blah', 'version'=>'1.0.0'[, 'should_notify'=>'reset iis']}
Here's what I have so far, code-wise. How can I modify this to branch based on what action chocolatey performs (install or ?
include_recipe 'chocolatey::default'
node['cookbook-name']['choco_packages'].each{ |package|
chocolatey package['name'] do
version package['version']
action :install
if package.instance_variable_defined?(:@should_notify) && package.should_notify == 'reset iis'
notify :run, 'execute[reset iis]', :immediately
end
end
}
execute 'reset iis' do
command 'iisreset'
action :nothing
end
Thanks