From 4092a1c43cc383e6912373249e1f6e5d4ccafc95 Mon Sep 17 00:00:00 2001 From: Sergio Oliveira Date: Sat, 19 Sep 2015 17:27:30 -0300 Subject: [PATCH] Forced yum and chef to reload cache when spb repo changes --- cookbooks/basics/recipes/default.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+), 0 deletions(-) diff --git a/cookbooks/basics/recipes/default.rb b/cookbooks/basics/recipes/default.rb index de735ba..649b4e3 100644 --- a/cookbooks/basics/recipes/default.rb +++ b/cookbooks/basics/recipes/default.rb @@ -74,9 +74,22 @@ if node['platform'] == 'centos' template '/etc/yum.repos.d/softwarepublico.repo' do owner 'root' mode 0644 + notifies :run, "execute[yum_clean_cache]", :immediately + notifies :create, "ruby_block[yum-cache-reload]", :immediately + end + execute 'yum_clean_cache' do + command 'yum clean all' + action :nothing + end + # reload internal Chef yum cache + ruby_block "yum-cache-reload" do + block { Chef::Provider::Package::Yum::YumCache.instance.reload } + action :nothing end end + + # reload node[:fqdn] to make sure it reflects the contents of /etc/hosts # without that the variable :fqdn would not be available on first run ruby_block 'fqdn:update' do -- libgit2 0.21.2