Windows installed package check (guard)


#1

I’m using Chef w/ the windows community cookbook.
I’ve created a definition that handles a multi step process of fetching an installer from a propitiatory repository to a temp directory, then running windows_package against it.
All is well with that work flow.

Now i want to guard the entire definition so it only runs if the thing is not already installed.
I know windows_package does this by searching the registry i even found the code in package.rb that does it.

https://github.com/opscode-cookbooks/windows/blob/master/providers/package.rb
The important bit looks to be
installed_packages.include?( "string in registry that means its installed " )

What i can’t figure out is how to call that, which is buried under providers in the windows cookbook, from the other cookbook that has my definition.

something like this didn’t work.
not_if installed_packages.include?( “foo” )

nor my next guess of
not_if Chef::Providers::WindowsPackage.installed_packages.include?( “foo” )