summaryrefslogtreecommitdiff
path: root/lib/chef/provider
diff options
context:
space:
mode:
authorLamont Granquist <lamont@chef.io>2019-09-18 11:03:40 -0700
committerGitHub <noreply@github.com>2019-09-18 11:03:40 -0700
commit36770a10485ac87c22ef38c2c7e4750e6153dbd3 (patch)
tree59c88ae6863676e0ccf3e844068a1b849689c930 /lib/chef/provider
parentf6d445c28467b5ea5741d05aed2bd1f657c4a1dd (diff)
parent6b9fc7e4628b9e4b8caba921e41e28218ec50ac6 (diff)
downloadchef-36770a10485ac87c22ef38c2c7e4750e6153dbd3.tar.gz
Merge pull request #8765 from MsysTechnologiesllc/Kapil/MSYS-1015_chocolatey_package_fails_using_extra_options
Fix for chocolatey_package fails using extra options
Diffstat (limited to 'lib/chef/provider')
-rw-r--r--lib/chef/provider/package/chocolatey.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/chef/provider/package/chocolatey.rb b/lib/chef/provider/package/chocolatey.rb
index 1bb379f471..fe90650846 100644
--- a/lib/chef/provider/package/chocolatey.rb
+++ b/lib/chef/provider/package/chocolatey.rb
@@ -210,7 +210,7 @@ class Chef
# @return [String] options from new_resource or empty string
def cmd_args(include_source: true)
cmd_args = [ new_resource.options ]
- cmd_args.push([ "-source", new_resource.source ]) if new_resource.source && include_source
+ cmd_args += common_options(include_source: include_source)
cmd_args
end
@@ -227,8 +227,8 @@ class Chef
available_versions =
begin
cmd = [ "list", "-r", pkg ]
- cmd.push( [ "-source", new_resource.source ] ) if new_resource.source
- cmd.push( new_resource.options ) if new_resource.options
+ cmd += common_options
+ cmd.push( new_resource.list_options ) if new_resource.list_options
raw = parse_list_output(*cmd)
raw.keys.each_with_object({}) do |name, available|
@@ -272,6 +272,14 @@ class Chef
def lowercase_names(names)
names.map(&:downcase)
end
+
+ def common_options(include_source: true)
+ args = []
+ args.push( [ "-source", new_resource.source ] ) if new_resource.source && include_source
+ args.push( [ "--user", new_resource.user ] ) if new_resource.user
+ args.push( [ "--password", new_resource.password ]) if new_resource.password
+ args
+ end
end
end
end