Puppet upgrade msi on windows
I'm running puppet on windows and I want to upgrade a package (java) I installed using an msi. I installed the package using
package { 'java':
ensure => installed,
provider => 'msi',
source => 'S:\jdk1.6.0_30.msi',
install_options => { 'INSTALLDIR' => 'C:\tools\java' },
}
Now I want to upgrade to build 31 for example, so I tried running
package { 'java':
ensure => installed,
provider => 'msi',
source => 'S:\jdk1.6.0_31.msi',
install_options => { 'INSTALLDIR' => 'C:\tools\java' },
}
this does not actually upgrade since the package 'java' is already installed. An when I tried changing the "ensure" value to latest, puppet said that the provider type must have features 'upgradeable'.
Is this just a windows limitation? Is there a way to upgrade the existing Java install using msi packages?
Solution 1:
Is this just a windows limitation?
The MSI provider seems pretty limited relative to the other package providers. This certainly isn't a limitation of Windows/MSI. I believe Windows provides what is needed to make those options work.
Is there a way to upgrade the existing Java install using msi packages?
One option might be to give up on the package msi provider and simply do it all with Exec statements. The msiexec
command has lots of options.
You could probably also come up with a way of arranging things so that if an upgrade needs to be done, the old version is purged first. Then a new version is installed, you would probably have to keep track of the version in a file or the registry somewhere, since the MSI providers doesn't give you any information about the version.
Solution 2:
The windows MSI plugin for Puppet isn't capable of understanding versions. Unlike Linux package management systems, there is no metadata catalog reference that Puppet has to look at for what versions are available.
The following is written from mind and untested, but would provide you with a way to enable upgrades. Whenever you get a new version, chain it in. Old versions can be removed from the list when you're sure that everything has been upgraded.
package { 'java':
ensure => absent,
provider => 'msi',
source => 'S:\jdk1.6.0_30.msi',
install_options => { 'INSTALLDIR' => 'C:\tools\java' },
}
-> #chaining operator forces uninstall before install
package { 'java-1.6.0_31':
ensure => installed,
provider => 'msi',
source => 'S:\jdk1.6.0_31.msi',
install_options => { 'INSTALLDIR' => 'C:\tools\java' },
}