Windows_package or package resource - Version check for msi installers

Hello All,

I am installing a msi installer by making use of the windows_package or package resource in Chef.
The problem i am seeing is that, the windows_package or the package resource doesn’t seem to be comparing the versions of the already installed msi package with the current msi package.

As a result of this, there are cases where the current msi package is run even though a higher version of the msi package is already installed. This results in the resource returning a failure exit code.

Is there an easy way to install msi packages where the version check if in built into the chef resource?

I was thinking maybe i could use a powershell script in the guard interpreter or make use of the msi library in ruby

Has anyone ever done this in an easier way?

I am still picking up Ruby, hence using Windows API’s is something i am trying to accomplish.


1 Like

The package resource makes no guarantees that a package will only be installed if the if the resurce version is greater than the one already installed. The package resource just checks if they are different and then assumes that if the msi the resource is pointing to has a different version, it should be installed.

If you want to ensure that a specific version be installed then you should use the version property. By using a version property, if the installed version is the same as the version specified even if the resource points to an http resource with a different version, the install will not proceed.