summaryrefslogtreecommitdiff
path: root/lib/chef/provider/package/yum.rb
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2015-06-02 16:36:46 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2015-06-02 18:52:12 -0700
commit23e3c799803ac1800149e27271c6168539cea25e (patch)
treec6394473fc32f9b30b50a309de765940a21d2c8c /lib/chef/provider/package/yum.rb
parent025cabb7158fb02a89250ef91cc94ce3b3c38648 (diff)
downloadchef-23e3c799803ac1800149e27271c6168539cea25e.tar.gz
fix package timeout attribute
updates all the shell_out calls to respect the timeout which is passed on the new_resource. the old `Chef::Config` yum timeout values are still respected and will override the default. the default of 900 seconds is preserved.
Diffstat (limited to 'lib/chef/provider/package/yum.rb')
-rw-r--r--lib/chef/provider/package/yum.rb10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/chef/provider/package/yum.rb b/lib/chef/provider/package/yum.rb
index fe67015103..85c2ba683c 100644
--- a/lib/chef/provider/package/yum.rb
+++ b/lib/chef/provider/package/yum.rb
@@ -1,4 +1,4 @@
-#
+
# Author:: Adam Jacob (<adam@opscode.com>)
# Copyright:: Copyright (c) 2008 Opscode, Inc.
# License:: Apache License, Version 2.0
@@ -18,7 +18,6 @@
require 'chef/config'
require 'chef/provider/package'
-require 'chef/mixin/shell_out'
require 'chef/mixin/which'
require 'chef/resource/package'
require 'singleton'
@@ -647,7 +646,6 @@ class Chef
# Cache for our installed and available packages, pulled in from yum-dump.py
class YumCache
- include Chef::Mixin::Command
include Chef::Mixin::Which
include Chef::Mixin::ShellOut
include Singleton
@@ -1028,7 +1026,7 @@ class Chef
def yum_command(command)
Chef::Log.debug("#{@new_resource}: yum command: \"#{command}\"")
- status = shell_out(command, {:timeout => Chef::Config[:yum_timeout]})
+ status = shell_out_with_timeout(command, {:timeout => Chef::Config[:yum_timeout]})
# This is fun: rpm can encounter errors in the %post/%postun scripts which aren't
# considered fatal - meaning the rpm is still successfully installed. These issue
@@ -1045,7 +1043,7 @@ class Chef
if l =~ %r{^error: %(post|postun)\(.*\) scriptlet failed, exit status \d+$}
Chef::Log.warn("#{@new_resource} caught non-fatal scriptlet issue: \"#{l}\". Can't trust yum exit status " +
"so running install again to verify.")
- status = shell_out(command, {:timeout => Chef::Config[:yum_timeout]})
+ status = shell_out_with_timeout(command, {:timeout => Chef::Config[:yum_timeout]})
break
end
end
@@ -1118,7 +1116,7 @@ class Chef
end
Chef::Log.debug("#{@new_resource} checking rpm status")
- shell_out!("rpm -qp --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' #{@new_resource.source}", :timeout => Chef::Config[:yum_timeout]).stdout.each_line do |line|
+ shell_out_with_timeout!("rpm -qp --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' #{@new_resource.source}", :timeout => Chef::Config[:yum_timeout]).stdout.each_line do |line|
case line
when /([\w\d_.-]+)\s([\w\d_.-]+)/
@current_resource.package_name($1)