summaryrefslogtreecommitdiff
path: root/lib/chef/provider/yum_repository.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/provider/yum_repository.rb')
-rw-r--r--lib/chef/provider/yum_repository.rb14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/chef/provider/yum_repository.rb b/lib/chef/provider/yum_repository.rb
index a3d19e95d3..9b32896733 100644
--- a/lib/chef/provider/yum_repository.rb
+++ b/lib/chef/provider/yum_repository.rb
@@ -44,7 +44,12 @@ class Chef
mode new_resource.mode
if new_resource.make_cache
notifies :run, "execute[yum clean metadata #{new_resource.repositoryid}]", :immediately if new_resource.clean_metadata || new_resource.clean_headers
- notifies :run, "execute[yum-makecache-#{new_resource.repositoryid}]", :immediately
+ # makecache fast only works on non-dnf systems.
+ if !which "dnf" && new_resource.makecache_fast
+ notifies :run, "execute[yum-makecache-fast-#{new_resource.repositoryid}]", :immediately
+ else
+ notifies :run, "execute[yum-makecache-#{new_resource.repositoryid}]", :immediately
+ end
notifies :flush_cache, "package[package-cache-reload-#{new_resource.repositoryid}]", :immediately
end
end
@@ -63,6 +68,13 @@ class Chef
only_if { new_resource.enabled }
end
+ # download only the minimum required metadata
+ execute "yum-makecache-fast-#{new_resource.repositoryid}" do
+ command "yum -q -y makecache fast --disablerepo=* --enablerepo=#{new_resource.repositoryid}"
+ action :nothing
+ only_if { new_resource.enabled }
+ end
+
package "package-cache-reload-#{new_resource.repositoryid}" do
action :nothing
end