summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-03-10 12:13:54 -0700
committerTim Smith <tsmith84@gmail.com>2020-04-16 15:23:29 -0700
commitf37f677165612afe360c1d9614d4220420dcbbe4 (patch)
treeb2afac92698252e5e7960fabd92d48f1eacb0041 /lib/chef
parent25038cc59f36d1b1e76ed8470ee1637d6960d302 (diff)
downloadchef-f37f677165612afe360c1d9614d4220420dcbbe4.tar.gz
Use .compact to remove nil values
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/provider/package/homebrew.rb9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/chef/provider/package/homebrew.rb b/lib/chef/provider/package/homebrew.rb
index bde2c5fb43..e5485161a6 100644
--- a/lib/chef/provider/package/homebrew.rb
+++ b/lib/chef/provider/package/homebrew.rb
@@ -54,8 +54,7 @@ class Chef
end
def install_package(names, versions)
- packages = names.select { |x| x unless x.nil? }
- brew("install", options, packages)
+ brew("install", options, names.compact)
end
def upgrade_package(name, version)
@@ -69,14 +68,12 @@ class Chef
end
def remove_package(names, versions)
- packages = names.select { |x| x unless x.nil? }
- brew("uninstall", options, packages)
+ brew("uninstall", options, names.compact)
end
# Homebrew doesn't really have a notion of purging, do a "force remove"
def purge_package(names, versions)
- packages = names.select { |x| x unless x.nil? }
- brew("uninstall", "--force", options, packages)
+ brew("uninstall", "--force", options, names.compact)
end
def brew(*args)