diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-12-19 11:02:56 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-12-19 11:02:56 -0800 |
commit | aebaee14c2d6c106914d1b3e3c9c3cbdf5bc29cb (patch) | |
tree | 04243c5d94d19b5e5da8ccf160d86f7c7fb43a3c | |
parent | b18272eeef335cde79a21a96c4686271dc3d290c (diff) | |
download | chef-lcg/dnf-provider.tar.gz |
remove FIXMEs around cache flushinglcg/dnf-provider
not going to actually fix this, not worth it.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r-- | lib/chef/provider/package/dnf.rb | 23 | ||||
-rw-r--r-- | lib/chef/provider/package/dnf/python_helper.rb | 8 |
2 files changed, 7 insertions, 24 deletions
diff --git a/lib/chef/provider/package/dnf.rb b/lib/chef/provider/package/dnf.rb index f48b1341a6..bf6aa2438f 100644 --- a/lib/chef/provider/package/dnf.rb +++ b/lib/chef/provider/package/dnf.rb @@ -91,7 +91,7 @@ class Chef resolved_names = names.each_with_index.map { |name, i| available_version(i).to_s unless name.nil? } dnf(new_resource.options, "-y install", resolved_names) end - flushcache_after + flushcache end # dnf upgrade does not work on uninstalled packaged, while install will upgrade @@ -100,25 +100,17 @@ class Chef def remove_package(names, versions) resolved_names = names.each_with_index.map { |name, i| installed_version(i).to_s unless name.nil? } dnf(new_resource.options, "-y remove", resolved_names) - flushcache_after + flushcache end alias_method :purge_package, :remove_package action :flush_cache do - python_helper.flushcache + flushcache end private - def flushcache_after - if new_resource.flush_cache[:after] - flushcache - else - flushcache_installed - end - end - def resolve_source_to_version_obj shell_out_with_timeout!("rpm -qp --queryformat '%{NAME} %{EPOCH} %{VERSION} %{RELEASE} %{ARCH}\n' #{new_resource.source}").stdout.each_line do |line| # this is another case of committing the sin of doing some lightweight mangling of RPM versions in ruby -- but the output of the rpm command @@ -154,12 +146,11 @@ class Chef @installed_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.flushcache - end - - def flushcache_installed - python_helper.flushcache_installed + 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 936c381371..466114b339 100644 --- a/lib/chef/provider/package/dnf/python_helper.rb +++ b/lib/chef/provider/package/dnf/python_helper.rb @@ -97,14 +97,6 @@ class Chef end end - def flushcache - restart # FIXME: make flushcache work + not leak memory - end - - def flushcache_installed - restart # FIXME: make flushcache work + not leak memory - end - def restart reap start |