windows_package resource :install action uninstalls existing software if already installed


#1

I’m having a challenge with a pretty simple cookbook.
My ultimate goal is to establish chef in an existing (largely windows) production environment, and we’re starting with an upgrade of some existing software.

Here’s my problem:

I have a recipe run an installshield wizard as a windows_package resource. It calls an answer file for handling its expected user input. I then have additional resources that stop the newly installed service, delete a configuration file then copy a new configuration file in its place & then start the service again.

If there is no previous version of the software installed on the machine this runs as expected. If there is any version of this software currently installed on the target machine, the installshield windows_package resource performs an uninstall instead.

I’ve explored things like testing software version using PowerShell (wmi) before running the installer - but I thought I’d start with the broader problem first in case I’m heading down an unnecessary path for my fix.

Has anyone else run into and resolved any issues like this with Chef for Windows?


#2

The package resource on windows will search the registry for info related to your installer. If it finds this information it will not attempt to re install the package unless you specify a specific version that is different from the one installed. In order for this idempotence to work as expected, its important that you give the package resource the EXACT same name as what it is labelled in the “add/remove programs” GUI. If these names are different, chef will not find the registry entry and assume the package needs to be installed. My hunch is that it is being reinstalled and there is possibly logic in the installer itself to uninstall when installed. So here are things to check:

  1. The name matches the package label
  2. Are you specifying an installer type or special custom arguments that may cause chef to override normal behavior used for InstallShield packages
  3. Try adding a custom argument to add a log file to the install (not sure what it is for install shield) and examine the log for clues as to what might be triggering an uninstall

If you can, it may be helpful to share your package resource code here.


#3

Thanks Matt!

That was my issue, as I didn’t include the version number in the package label,
Thanks for clarifying how this process works too, this was a very helpful response!

=-Eric