summaryrefslogtreecommitdiff
path: root/lib/chef/provider/package
diff options
context:
space:
mode:
authorBryan McLellan <btm@loftninjas.org>2017-10-16 21:42:38 -0400
committerGitHub <noreply@github.com>2017-10-16 21:42:38 -0400
commit2a7c69b0013731f3392c63de05dea6611ff2ee53 (patch)
treec88ba95d21b5b2e97a4e29dcd3d3bfc4df2dc43d /lib/chef/provider/package
parent87674bfceb5f818b96388aa786121546f1d67a39 (diff)
parentf04a1c83c84bf5108e4346eff20c472de2f51334 (diff)
downloadchef-2a7c69b0013731f3392c63de05dea6611ff2ee53.tar.gz
Merge pull request #6437 from MsysTechnologiesllc/dh/array_choco_pkg_artifactory
[MSYS-647] array support for choco pkg from artifactory
Diffstat (limited to 'lib/chef/provider/package')
-rw-r--r--lib/chef/provider/package/chocolatey.rb21
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/chef/provider/package/chocolatey.rb b/lib/chef/provider/package/chocolatey.rb
index c832116377..3536d807ad 100644
--- a/lib/chef/provider/package/chocolatey.rb
+++ b/lib/chef/provider/package/chocolatey.rb
@@ -237,15 +237,20 @@ EOS
#
# @return [Hash] name-to-version mapping of available packages
def available_packages
- @available_packages ||=
- begin
- cmd = [ "list -r #{package_name_array.join ' '}" ]
- cmd.push( "-source #{new_resource.source}" ) if new_resource.source
- raw = parse_list_output(*cmd)
- raw.keys.each_with_object({}) do |name, available|
- available[name] = desired_name_versions[name] || raw[name]
+ return @available_packages if @available_packages
+ @available_packages = {}
+ package_name_array.each do |pkg|
+ available_versions =
+ begin
+ cmd = [ "list -r #{pkg}" ]
+ cmd.push( "-source #{new_resource.source}" ) if new_resource.source
+ raw = parse_list_output(*cmd)
+ raw.keys.each_with_object({}) do |name, available|
+ available[name] = desired_name_versions[name] || raw[name]
+ end
end
- end
+ @available_packages.merge! available_versions
+ end
@available_packages
end