96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
# File 'lib/chef/provider/package/cab.rb', line 96
def installed_version
package = new_cab_identity
logger.trace("#{new_resource} searching for installed package #{package["name"]}")
existing_package_identities = installed_packages.map do |p|
split_package_identity(p["package_identity"])
end
found_packages = existing_package_identities.select do |existing_package_ident|
existing_package_ident["version"] == package["version"].chomp && existing_package_ident["name"] == package["name"]
end
if found_packages.empty?
nil
elsif found_packages.length == 1
found_packages.first["version"]
else
raise Chef::Exceptions::Package, "Found multiple packages installed matching name #{package["name"]}, found: #{found_packages.length} matches"
end
end
|