summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2020-11-11 15:29:40 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2020-11-11 15:29:40 -0800
commit6328147a70ad904f6d757c778be78159d63e7a8a (patch)
tree6fe9437fae348b85a00444bcd769352e92db882f
parentfc2f678ad1a0fe95f4d2cd1b275357e91bdaed2e (diff)
downloadchef-6328147a70ad904f6d757c778be78159d63e7a8a.tar.gz
cleanup
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--lib/chef/provider/package/zypper.rb3
-rw-r--r--spec/functional/resource/zypper_package_spec.rb6
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/chef/provider/package/zypper.rb b/lib/chef/provider/package/zypper.rb
index 1cccdf650f..6ed7339e32 100644
--- a/lib/chef/provider/package/zypper.rb
+++ b/lib/chef/provider/package/zypper.rb
@@ -102,6 +102,7 @@ class Chef
if md = line.match(/^(\S*)\s+\|\s+(\S+)\s+\|\s+(\S+)\s+\|\s+(\S+)\s+\|\s+(\S+)\s+\|\s+(.*)$/)
(status, name, type, version, arch, repo) = [ md[1], md[2], md[3], md[4], md[5], md[6] ]
next if version == "Version" # header
+
return version
end
end
@@ -121,7 +122,7 @@ class Chef
end
def zip(names, versions)
- ret = names.zip(versions).map do |n, v|
+ names.zip(versions).map do |n, v|
(v.nil? || v.empty?) ? n : "#{n}=#{v}"
end.compact
end
diff --git a/spec/functional/resource/zypper_package_spec.rb b/spec/functional/resource/zypper_package_spec.rb
index e143f64a9f..ce6a3bf33c 100644
--- a/spec/functional/resource/zypper_package_spec.rb
+++ b/spec/functional/resource/zypper_package_spec.rb
@@ -97,9 +97,11 @@ describe Chef::Resource::ZypperPackage, :requires_root, :suse_only do
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.2-1.#{pkg_arch}$")
end
- it "multipackage" do
+ it "multipackage installs which result in nils from the superclass" do
+ # this looks weird, it tests an internal condition of the allow_nils behavior where the arrays passed to install_package will have
+ # nil values, and ensures that doesn't wind up creating weirdness in the resulting shell_out that causes it to fail
preinstall("chef_rpm-1.2-1.#{pkg_arch}.rpm")
- zypper_package.package_name(["chef_rpm", "chef_rpm"])
+ zypper_package.package_name(%w{chef_rpm chef_rpm})
zypper_package.version(["1.2", "1.10"])
zypper_package.run_action(:install)
expect(zypper_package.updated_by_last_action?).to be true