Issue #11868 has been updated by Josh Cooper.

<pre>
Previously, Puppet recorded MSI packages it had installed in a YAML
file. However, if the file was deleted or the system modified, e.g.
Add/Remove Programs, then Puppet did not know the package state had
changed.

Also, if the name of the package did not change across versions, e.g.
VMware Tools, then puppet would report the package as insync even though
the installed version could be different than the one pointed to by the
source parameter.

Also, msiexec.exe returns non-zero exit codes when either the package
requests a reboot (194), the system requires a reboot (3010), e.g. due
to a locked file, or the system initiates a reboot (1641). This would
cause puppet to think the install failed, and it would try to reinstall
the packge the next time it ran (since the YAML file didn't get
updated).

This commit changes the msi package provider to use the Installer
Automation (COM) interface to query the state of the system[1]. It will
now accurately report on installed packages, even those it did not
install, including Puppet itself (#13444). If a package is removed via
Add/Remove Programs, Puppet will re-install it the next time it runs.

The MSI package provider will now warn in the various reboot scenarios,
but report the overall install/uninstall as successful (#14055).

When using the msi package resource, the resource title should match the
'ProductName' property in the MSI Property table, which is also the
value displayed in Add/Remove Programs, e.g.

package { 'Microsoft Visual C++ 2008 Redistributable - x86 9.0.30729.4148':
  ensure => installed,
  ...
}
In cases where the ProductName does not change across versions, e.g.
VMware Tools, you MUST use the PackageCode as the name of the resource
in order for puppet to accurately determine the state of the system:

package { '{0E3AA38E-EAD3-4348-B5C5-051B6852CED6}':
  ensure => installed,
  ...
}
You can obtain the PackageCode in ruby using:

require 'win32ole'
installer = WIN32OLE.new('WindowsInstaller.Installer')
db = installer.OpenDatabase(path, 0)
puts db.SummaryInformation.Property(9)
where is the path to the MSI.

The msi provider does not automatically compare PackageCodes when
determining if the resource is insync, because the source MSI could be
on a network share, and we do not want to copy the potentially large
file just to see if changes need to be made.

The msi provider does not use the Installer interface to perform
install and uninstall, because I have not found a way to obtain useful
error codes when reboots are requested. Instead the methods
InstallProduct and ConfigureProduct raise exceptions with the
general 0x80020009 error, which means 'Exception occurred'. So for now
we continue to use msiexec.exe for install and uninstall, though the msi
provider may not uninstall multi-instance transforms correctly, since
the transform (MST) used to install the package needs to be respecified
during uninstall. This could be resolved by allowing uninstall_options
to be specified, or figuring out how to obtain useful error codes when
using the Installer interface.

[1] 
http://msdn.microsoft.com/en-us/library/windows/desktop/aa369432(v=vs.85).aspx
</pre>
----------------------------------------
Bug #11868: msi package provider can only manage packages it installed
https://projects.puppetlabs.com/issues/11868#change-66718

Author: Josh Cooper
Status: Merged - Pending Release
Priority: Normal
Assignee: Josh Cooper
Category: windows
Target version: 2.7.18
Affected Puppet version: 2.7.6
Keywords: windows msi package
Branch: https://github.com/puppetlabs/puppet/pull/851


The msi package provider keeps track of packages it installed in a yaml file. 
As a result, it doesn't know about packages it didn't install.

The msi package provider should query the registry 
<http://msdn.microsoft.com/en-us/library/aa372105(VS.85).aspx>, or access that 
information through WMI's Win32_Product 
<http://msdn.microsoft.com/en-us/library/windows/desktop/aa394378(v=vs.85).aspx>
 This way it will accurately report on the state of the system.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to