[chef] Windows installed package check (guard)


Chronological Thread 
  • From: Alex Anagnos < >
  • To:
  • Subject: [chef] Windows installed package check (guard)
  • Date: Wed, 28 May 2014 18:07:29 -0500

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.

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" )




  • [chef] Windows installed package check (guard), Alex Anagnos, 05/28/2014

Archive powered by MHonArc 2.6.16.

§