summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2021-04-30 16:01:12 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2021-04-30 16:01:12 -0700
commit7dab8719216d9ed112bc8905202644df9b521f5f (patch)
tree83929ef68a9af6dd0a52a3e764d94b5f7dfccfc1
parente41ca18ac283ae12f7560d7d349601cb2409172f (diff)
downloadchef-7dab8719216d9ed112bc8905202644df9b521f5f.tar.gz
have to still restart dnf
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--lib/chef/provider/package/dnf.rb5
-rw-r--r--lib/chef/provider/package/dnf/python_helper.rb3
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/chef/provider/package/dnf.rb b/lib/chef/provider/package/dnf.rb
index c0c7def44f..5c74ad0414 100644
--- a/lib/chef/provider/package/dnf.rb
+++ b/lib/chef/provider/package/dnf.rb
@@ -242,8 +242,11 @@ class Chef
@current_version[index]
end
+ # cache flushing is accomplished by simply restarting the python helper. this produces a roughly
+ # 15% hit to the runtime of installing/removing/upgrading packages. correctly using multipackage
+ # array installs (and the multipackage cookbook) can produce 600% improvements in runtime.
def flushcache
- python_helper.close_rpmdb
+ python_helper.restart
end
def dnf(*args)
diff --git a/lib/chef/provider/package/dnf/python_helper.rb b/lib/chef/provider/package/dnf/python_helper.rb
index b02db340ba..3e5fff04e4 100644
--- a/lib/chef/provider/package/dnf/python_helper.rb
+++ b/lib/chef/provider/package/dnf/python_helper.rb
@@ -205,7 +205,7 @@ class Chef
Chef::Log.trace "discarding output on stderr/stdout from python helper: #{output}"
end
ret
- rescue EOFError, Errno::EPIPE, Timeout::Error, Errno::ESRCH => e
+ rescue => e
output = drain_fds
if ( max_retries -= 1 ) > 0 && !ENV["YUM_HELPER_NO_RETRIES"]
unless output.empty?
@@ -214,6 +214,7 @@ class Chef
restart
retry
else
+ restart
raise e if output.empty?
raise "dnf-helper.py had stderr/stdout output:\n\n#{output}"