summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Kantrowitz <noah@coderanger.net>2017-04-10 18:30:06 -0700
committerNoah Kantrowitz <noah@coderanger.net>2017-04-10 18:30:06 -0700
commit34a79a6cf8be2fe491e1651b5a61f02d4854c07b (patch)
tree8874b448b78823ce0ace66896fe7c3963a843a36
parent5932782cabcdc434e431711027af1211d7e0d31c (diff)
downloadchef-34a79a6cf8be2fe491e1651b5a61f02d4854c07b.tar.gz
Fix expand_options to cope with arrays too.
Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
-rw-r--r--lib/chef/provider/package.rb2
-rw-r--r--spec/unit/provider/package/yum_spec.rb4
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/chef/provider/package.rb b/lib/chef/provider/package.rb
index 65dda05f85..4a5a6e2e4d 100644
--- a/lib/chef/provider/package.rb
+++ b/lib/chef/provider/package.rb
@@ -297,7 +297,7 @@ class Chef
def expand_options(options)
# its deprecated but still work to do to deprecate it fully
#Chef.deprecated(:package_misc, "expand_options is deprecated, use shell_out_compact or shell_out_compact_timeout instead")
- options ? " #{options}" : ""
+ options ? " #{options.is_a?(Array) ? Shellwords.join(options) : options}" : ""
end
# Check the current_version against either the candidate_version or the new_version
diff --git a/spec/unit/provider/package/yum_spec.rb b/spec/unit/provider/package/yum_spec.rb
index a662ec9013..e8eb830f65 100644
--- a/spec/unit/provider/package/yum_spec.rb
+++ b/spec/unit/provider/package/yum_spec.rb
@@ -558,7 +558,7 @@ describe Chef::Provider::Package::Yum do
it "installs the package with the options given in the resource" do
@provider.load_current_resource
allow(@provider).to receive(:candidate_version).and_return("11")
- allow(@new_resource).to receive(:options).and_return("--disablerepo epmd")
+ @new_resource.options("--disablerepo epmd")
allow(Chef::Provider::Package::Yum::RPMUtils).to receive(:rpmvercmp).and_return(-1)
expect(@provider).to receive(:yum_command).with(
"-d0 -e0 -y --disablerepo epmd install cups-11"
@@ -2261,7 +2261,7 @@ describe "Chef::Provider::Package::Yum - Multi" do
expect(@provider).to receive(:yum_command).with(
"-d0 -e0 -y --disablerepo epmd install cups-1.2.4-11.19.el5 vim-1.0"
)
- allow(@new_resource).to receive(:options).and_return("--disablerepo epmd")
+ @new_resource.options("--disablerepo epmd")
@provider.install_package(%w{cups vim}, ["1.2.4-11.19.el5", "1.0"])
end