Commit 4092a1c43cc383e6912373249e1f6e5d4ccafc95
1 parent
2d682a01
Exists in
master
and in
79 other branches
Forced yum and chef to reload cache when spb repo changes
Showing
1 changed file
with
13 additions
and
0 deletions
Show diff stats
cookbooks/basics/recipes/default.rb
| @@ -74,9 +74,22 @@ if node['platform'] == 'centos' | @@ -74,9 +74,22 @@ if node['platform'] == 'centos' | ||
| 74 | template '/etc/yum.repos.d/softwarepublico.repo' do | 74 | template '/etc/yum.repos.d/softwarepublico.repo' do |
| 75 | owner 'root' | 75 | owner 'root' |
| 76 | mode 0644 | 76 | mode 0644 |
| 77 | + notifies :run, "execute[yum_clean_cache]", :immediately | ||
| 78 | + notifies :create, "ruby_block[yum-cache-reload]", :immediately | ||
| 79 | + end | ||
| 80 | + execute 'yum_clean_cache' do | ||
| 81 | + command 'yum clean all' | ||
| 82 | + action :nothing | ||
| 83 | + end | ||
| 84 | + # reload internal Chef yum cache | ||
| 85 | + ruby_block "yum-cache-reload" do | ||
| 86 | + block { Chef::Provider::Package::Yum::YumCache.instance.reload } | ||
| 87 | + action :nothing | ||
| 77 | end | 88 | end |
| 78 | end | 89 | end |
| 79 | 90 | ||
| 91 | + | ||
| 92 | + | ||
| 80 | # reload node[:fqdn] to make sure it reflects the contents of /etc/hosts | 93 | # reload node[:fqdn] to make sure it reflects the contents of /etc/hosts |
| 81 | # without that the variable :fqdn would not be available on first run | 94 | # without that the variable :fqdn would not be available on first run |
| 82 | ruby_block 'fqdn:update' do | 95 | ruby_block 'fqdn:update' do |