summaryrefslogtreecommitdiff
path: root/lib/chef/provider/package/apt.rb
diff options
context:
space:
mode:
authorClaire McQuin <mcquin@users.noreply.github.com>2014-06-10 16:16:31 -0700
committerClaire McQuin <mcquin@users.noreply.github.com>2014-06-10 16:16:31 -0700
commit3ca542e7a2e6eab4a19c13e1938d154aa22cb44d (patch)
tree8f08d82d7b26841e6da516ac6b88764d2c875f9a /lib/chef/provider/package/apt.rb
parente5cbd0d532a393b10f073bccd1b5045b9082b9ab (diff)
parente9cfad2fd5c2c659e51fa7ef07906e1a80af7236 (diff)
downloadchef-3ca542e7a2e6eab4a19c13e1938d154aa22cb44d.tar.gz
Merge pull request #1462 from pdf/CHEF-5168
[CHEF-5168] Apt Package provider times out
Diffstat (limited to 'lib/chef/provider/package/apt.rb')
-rw-r--r--lib/chef/provider/package/apt.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/chef/provider/package/apt.rb b/lib/chef/provider/package/apt.rb
index 98534a4d01..06d86aa44c 100644
--- a/lib/chef/provider/package/apt.rb
+++ b/lib/chef/provider/package/apt.rb
@@ -18,7 +18,7 @@
require 'chef/provider/package'
require 'chef/mixin/command'
-require 'chef/resource/package'
+require 'chef/resource/apt_package'
require 'chef/mixin/shell_out'
@@ -31,7 +31,7 @@ class Chef
attr_accessor :is_virtual_package
def load_current_resource
- @current_resource = Chef::Resource::Package.new(@new_resource.name)
+ @current_resource = Chef::Resource::AptPackage.new(@new_resource.name)
@current_resource.package_name(@new_resource.package_name)
check_package_state(@new_resource.package_name)
@current_resource
@@ -55,7 +55,7 @@ class Chef
Chef::Log.debug("#{@new_resource} checking package status for #{package}")
installed = false
- shell_out!("apt-cache#{expand_options(default_release_options)} policy #{package}").stdout.each_line do |line|
+ shell_out!("apt-cache#{expand_options(default_release_options)} policy #{package}", :timeout => @new_resource.timeout).stdout.each_line do |line|
case line
when /^\s{2}Installed: (.+)$/
installed_version = $1
@@ -72,7 +72,7 @@ class Chef
if candidate_version == '(none)'
# This may not be an appropriate assumption, but it shouldn't break anything that already worked -- btm
@is_virtual_package = true
- showpkg = shell_out!("apt-cache showpkg #{package}").stdout
+ showpkg = shell_out!("apt-cache showpkg #{package}", :timeout => @new_resource.timeout).stdout
providers = Hash.new
# Returns all lines after 'Reverse Provides:'
showpkg.rpartition(/Reverse Provides:\s*#{$/}/)[2].each_line do |line|
@@ -132,7 +132,7 @@ class Chef
# interactive prompts. Command is run with default localization rather
# than forcing locale to "C", so command output may not be stable.
def run_noninteractive(command)
- shell_out!(command, :env => { "DEBIAN_FRONTEND" => "noninteractive", "LC_ALL" => nil })
+ shell_out!(command, :env => { "DEBIAN_FRONTEND" => "noninteractive", "LC_ALL" => nil }, :timeout => @new_resource.timeout)
end
end