Commit ecdbc2b0 authored by Sean OMeara's avatar Sean OMeara

adding a yum clean before yum makecache in action :create

parent af04c9d4
......@@ -47,10 +47,16 @@ action :create do
variables(:config => new_resource)
if new_resource.make_cache
notifies :run, "execute[yum-makecache-#{new_resource.repositoryid}]", :immediately
notifies :run, "execute[yum clean #{new_resource.repositoryid}]", :immediately
notifies :create, "ruby_block[yum-cache-reload-#{new_resource.repositoryid}]", :immediately
end
end
execute "yum clean #{new_resource.repositoryid}" do
command "yum clean all --disablerepo=* --enablerepo=#{new_resource.repositoryid}"
action :nothing
end
# get the metadata for this repo only
execute "yum-makecache-#{new_resource.repositoryid}" do
command "yum -q makecache --disablerepo=* --enablerepo=#{new_resource.repositoryid}"
......
......@@ -6,5 +6,4 @@ describe 'yum::default' do
it 'creates yum_globalconfig[/etc/yum.conf]' do
expect(chef_run).to create_yum_globalconfig('/etc/yum.conf')
end
end
......@@ -4,7 +4,7 @@ describe 'yum_test::test_globalconfig_one' do
let(:test_global_config_one_run) do
ChefSpec::SoloRunner.new(
:step_into => 'yum_globalconfig'
).converge(described_recipe)
).converge(described_recipe)
end
let(:test_globalconfig_one_content) do
......
......@@ -4,7 +4,7 @@ describe 'yum_test::test_globalconfig_two' do
let(:test_globalconfig_two_run) do
ChefSpec::SoloRunner.new(
:step_into => 'yum_globalconfig'
).converge(described_recipe)
).converge(described_recipe)
end
let(:test_globalconfig_two_content) do
......
......@@ -4,7 +4,7 @@ describe 'yum_test::test_repository_eight' do
let(:test_repository_eight_run) do
ChefSpec::SoloRunner.new(
:step_into => 'yum_repository'
).converge(described_recipe)
).converge(described_recipe)
end
let(:test_repository_eight_template) do
......@@ -22,17 +22,17 @@ Have a nice day.
it 'creates yum_repository[test8]' do
expect(test_repository_eight_run).to create_yum_repository('test8')
.with(
:source => 'custom_template.erb',
:description => 'an test',
:baseurl => 'http://drop.the.baseurl.biz'
:source => 'custom_template.erb',
:description => 'an test',
:baseurl => 'http://drop.the.baseurl.biz'
)
end
it 'steps into yum_repository and creates template[/etc/yum.repos.d/test8.repo]' do
expect(test_repository_eight_run).to create_template('/etc/yum.repos.d/test8.repo')
.with(
:path => '/etc/yum.repos.d/test8.repo',
:source => 'custom_template.erb'
:path => '/etc/yum.repos.d/test8.repo',
:source => 'custom_template.erb'
)
end
......@@ -41,10 +41,17 @@ Have a nice day.
.with_content(test_repository_eight_content)
end
it 'steps into yum_repository and runs execute[yum clean test8]' do
expect(test_repository_eight_run).to_not run_execute('yum clean test8')
.with(
:command => 'yum clean --disablerepo=* --enablerepo=test8'
)
end
it 'steps into yum_repository and runs execute[yum-makecache-test8]' do
expect(test_repository_eight_run).to_not run_execute('yum-makecache-test8')
.with(
:command => 'yum -q makecache --disablerepo=* --enablerepo=test8'
:command => 'yum -q makecache --disablerepo=* --enablerepo=test8'
)
end
......@@ -60,5 +67,4 @@ Have a nice day.
expect(test_repository_eight_template).to notify('ruby_block[yum-cache-reload-test8]')
end
end
end
......@@ -4,7 +4,7 @@ describe 'yum_test::test_repository_five' do
let(:test_repository_five_run) do
ChefSpec::SoloRunner.new(
:step_into => 'yum_repository'
).converge(described_recipe)
).converge(described_recipe)
end
let(:test_repository_five_file) do
......
......@@ -4,7 +4,7 @@ describe 'yum_test::test_repository_four' do
let(:test_repository_four_run) do
ChefSpec::SoloRunner.new(
:step_into => 'yum_repository'
).converge(described_recipe)
).converge(described_recipe)
end
let(:test_repository_four_file) do
......
......@@ -4,7 +4,7 @@ describe 'yum_test::test_repository_nine' do
let(:test_repository_nine_run) do
ChefSpec::SoloRunner.new(
:step_into => 'yum_repository'
).converge(described_recipe)
).converge(described_recipe)
end
let(:test_repository_nine_template) do
......@@ -22,18 +22,18 @@ Have a nice day.
it 'creates yum_repository[test9]' do
expect(test_repository_nine_run).to create_yum_repository('test9')
.with(
:source => 'custom_template.erb',
:description => 'an test',
:baseurl => 'http://drop.the.baseurl.biz',
:enabled => false
:source => 'custom_template.erb',
:description => 'an test',
:baseurl => 'http://drop.the.baseurl.biz',
:enabled => false
)
end
it 'steps into yum_repository and creates template[/etc/yum.repos.d/test9.repo]' do
expect(test_repository_nine_run).to create_template('/etc/yum.repos.d/test9.repo')
.with(
:path => '/etc/yum.repos.d/test9.repo',
:source => 'custom_template.erb'
:path => '/etc/yum.repos.d/test9.repo',
:source => 'custom_template.erb'
)
end
......@@ -42,10 +42,17 @@ Have a nice day.
.with_content(test_repository_nine_content)
end
it 'steps into yum_repository and runs execute[yum clean test9]' do
expect(test_repository_nine_run).to_not run_execute('yum clean test9')
.with(
:command => 'yum clean --disablerepo=* --enablerepo=test9'
)
end
it 'steps into yum_repository and runs execute[yum-makecache-test9]' do
expect(test_repository_nine_run).to_not run_execute('yum-makecache-test9')
.with(
:command => 'yum -q makecache --disablerepo=* --enablerepo=test9'
:command => 'yum -q makecache --disablerepo=* --enablerepo=test9'
)
end
......@@ -61,5 +68,4 @@ Have a nice day.
expect(test_repository_nine_template).to notify('ruby_block[yum-cache-reload-test9]')
end
end
end
......@@ -4,7 +4,7 @@ describe 'yum_test::test_repository_one' do
let(:test_repository_one_run) do
ChefSpec::SoloRunner.new(
:step_into => 'yum_repository'
).converge(described_recipe)
).converge(described_recipe)
end
let(:test_repository_one_template) do
......@@ -37,6 +37,10 @@ sslverify=true
expect(test_repository_one_run).to render_file('/etc/yum.repos.d/test1.repo').with_content(test_repository_one_content)
end
it 'steps into yum_repository and runs execute[yum clean test1]' do
expect(test_repository_one_run).to_not run_execute('yum clean test1')
end
it 'steps into yum_repository and runs execute[yum-makecache-test1]' do
expect(test_repository_one_run).to_not run_execute('yum-makecache-test1')
end
......@@ -53,5 +57,4 @@ sslverify=true
expect(test_repository_one_template).to notify('ruby_block[yum-cache-reload-test1]')
end
end
end
......@@ -4,7 +4,7 @@ describe 'yum_test::test_repository_seven' do
let(:test_repository_seven_run) do
ChefSpec::SoloRunner.new(
:step_into => 'yum_repository'
).converge(described_recipe)
).converge(described_recipe)
end
let(:test_repository_seven_template) do
......@@ -38,6 +38,10 @@ sslverify=true
expect(test_repository_seven_run).to render_file('/etc/yum.repos.d/test7.repo').with_content(test_repository_seven_content)
end
it 'steps into yum_repository and runs execute[yum clean test7]' do
expect(test_repository_seven_run).to_not run_execute('yum clean test7')
end
it 'steps into yum_repository and runs execute[yum-makecache-test7]' do
expect(test_repository_seven_run).to_not run_execute('yum-makecache-test7')
end
......@@ -54,5 +58,4 @@ sslverify=true
expect(test_repository_seven_template).to notify('ruby_block[yum-cache-reload-test7]')
end
end
end
......@@ -4,7 +4,7 @@ describe 'yum_test::test_repository_six' do
let(:test_repository_six_run) do
ChefSpec::SoloRunner.new(
:step_into => 'yum_repository'
).converge(described_recipe)
).converge(described_recipe)
end
let(:test_repository_six_template) do
......@@ -37,6 +37,10 @@ sslverify=true
expect(test_repository_six_run).to render_file('/etc/yum.repos.d/test6.repo').with_content(test_repository_six_content)
end
it 'steps into yum_repository and runs execute[yum clean test6]' do
expect(test_repository_six_run).to_not run_execute('yum clean test6')
end
it 'steps into yum_repository and runs execute[yum-makecache-test6]' do
expect(test_repository_six_run).to_not run_execute('yum-makecache-test6')
end
......@@ -53,5 +57,4 @@ sslverify=true
expect(test_repository_six_template).to notify('ruby_block[yum-cache-reload-test6]')
end
end
end
......@@ -4,7 +4,7 @@ describe 'yum_test::test_repository_three' do
let(:test_repository_three_run) do
ChefSpec::SoloRunner.new(
:step_into => 'yum_repository'
).converge(described_recipe)
).converge(described_recipe)
end
let(:test_repository_three_template) do
......@@ -37,6 +37,10 @@ sslverify=true
expect(test_repository_three_run).to render_file('/etc/yum.repos.d/test3.repo').with_content(test_repository_three_content)
end
it 'steps into yum_repository and runs execute[yum clean test3]' do
expect(test_repository_three_run).to_not run_execute('yum clean test3')
end
it 'steps into yum_repository and runs execute[yum-makecache-test3]' do
expect(test_repository_three_run).to_not run_execute('yum-makecache-test3')
end
......
require 'spec_helper'
describe 'yum_test::test_repository_two' do
let(:test_repository_two_run) do
ChefSpec::SoloRunner.new(
:step_into => 'yum_repository'
).converge(described_recipe)
).converge(described_recipe)
end
let(:test_repository_two_template) do
......@@ -62,6 +61,10 @@ timeout=10
expect(test_repository_two_run).to render_file('/etc/yum.repos.d/unit-test-2.repo').with_content(test_repository_two_content)
end
it 'steps into yum_repository and runs execute[yum clean unit-test2]' do
expect(test_repository_two_run).to_not run_execute('yum clean unit-test-2')
end
it 'steps into yum_repository and runs execute[yum-makecache-unit-test-2]' do
expect(test_repository_two_run).to_not run_execute('yum-makecache-unit-test-2')
end
......@@ -78,5 +81,4 @@ timeout=10
expect(test_repository_two_template).to notify('ruby_block[yum-cache-reload-unit-test-2]')
end
end
end
......@@ -4,7 +4,7 @@ when 'fedora'
mirrorlist 'http://mirrors.rpmfusion.org/mirrorlist?repo=free-fedora-$releasever&arch=$basearch'
enabled true
options(
'metadata_expire' => '7d'
'metadata_expire' => '7d'
)
end
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment