diff options
author | Phil Dibowitz <phil@ipom.com> | 2015-01-15 16:48:09 -0800 |
---|---|---|
committer | Phil Dibowitz <phil@ipom.com> | 2015-02-03 19:32:36 -0800 |
commit | 48e2d436830528cd2364868981cf9b46f3c91d6a (patch) | |
tree | e4d87bd695ae0dc58b6046764d97a16947730dc2 /lib/chef/provider/package/apt.rb | |
parent | 1c0134bacd2248b5d5c31c94a941d7ccf5784911 (diff) | |
download | chef-48e2d436830528cd2364868981cf9b46f3c91d6a.tar.gz |
Revert "Make yum always use arrays internally"
This reverts commit a88c852e7166c2d209d0670f668cf67feab19222.
We can't easily do this without changing a LOT of other assumptions. Since all
the consumer sites already call `as_array` functions, it's easier to keep those
safe.
Diffstat (limited to 'lib/chef/provider/package/apt.rb')
-rw-r--r-- | lib/chef/provider/package/apt.rb | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/chef/provider/package/apt.rb b/lib/chef/provider/package/apt.rb index b523cdc7cc..099a4a9b61 100644 --- a/lib/chef/provider/package/apt.rb +++ b/lib/chef/provider/package/apt.rb @@ -51,17 +51,19 @@ class Chef end def check_package_state(package) - final_installed_version = [] - final_candidate_version = [] - final_installed = [] - final_virtual = [] + if package.is_a?(Array) + final_installed_version = [] + final_candidate_version = [] + final_installed = [] + final_virtual = [] + end installed = virtual = false installed_version = candidate_version = nil [package].flatten.each do |pkg| installed = virtual = false installed_version = candidate_version = nil - shell_out!("apt-cache#{expand_options(default_release_options)} policy #{pkg}", {:timeout=>900}).stdout.each_line do |line| + shell_out!("apt-cache#{expand_options(default_release_options)} policy #{pkg}").stdout.each_line do |line| case line when /^\s{2}Installed: (.+)$/ installed_version = $1 @@ -77,9 +79,9 @@ class Chef if candidate_version == '(none)' # This may not be an appropriate assumption, but it shouldn't break anything that already worked -- btm virtual = true - showpkg = shell_out!("apt-cache showpkg #{package}", {:timeout => 900}).stdout + showpkg = shell_out!("apt-cache showpkg #{package}").stdout providers = Hash.new - showpkg.rpartition(/Reverse Provides: ?#{$/}/)[2].each_line do |line| + showpkg.rpartition(/Reverse Provides:? #{$/}/)[2].each_line do |line| provider, version = line.split providers[provider] = version end |