class MsiPackage

Constants

UILevel

Public Class Methods

each() { |package| ... } click to toggle source
# File lib/puppet/provider/package/msi.rb, line 25
def self.each(&block)
  inst = installer
  inst.UILevel = 2

  inst.Products.each do |guid|
    # products may be advertised, installed in a different user
    # context, etc, we only want to know about products currently
    # installed in our context.
    next unless inst.ProductState(guid) == 5

    package = {
      :name        => inst.ProductInfo(guid, 'ProductName'),
      # although packages have a version, the provider isn't versionable,
      # so we can't return a version
      # :ensure      => inst.ProductInfo(guid, 'VersionString'),
      :ensure      => :installed,
      :provider    => :msi,
      :productcode => guid,
      :packagecode => inst.ProductInfo(guid, 'PackageCode')
    }

    yield package
  end
end
installer() click to toggle source
# File lib/puppet/provider/package/msi.rb, line 21
def self.installer
  WIN32OLE.new("WindowsInstaller.Installer")
end