2014-01-07 01:53:19 +01:00
|
|
|
require 'spec_helper_acceptance'
|
|
|
|
|
2014-07-31 01:54:28 +02:00
|
|
|
describe 'apt class' do
|
2014-01-07 01:53:19 +01:00
|
|
|
|
2014-01-09 20:26:59 +01:00
|
|
|
context 'reset' do
|
|
|
|
it 'fixes the sources.list' do
|
|
|
|
shell('cp /etc/apt/sources.list /tmp')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-07-31 01:54:28 +02:00
|
|
|
context 'all the things' do
|
2014-01-07 01:53:19 +01:00
|
|
|
it 'should work with no errors' do
|
|
|
|
pp = <<-EOS
|
2015-06-17 23:56:22 +02:00
|
|
|
if $::lsbdistcodename == 'lucid' {
|
|
|
|
$sources = undef
|
|
|
|
} else {
|
|
|
|
$sources = {
|
|
|
|
'puppetlabs' => {
|
|
|
|
'ensure' => present,
|
|
|
|
'location' => 'http://apt.puppetlabs.com',
|
|
|
|
'repos' => 'main',
|
|
|
|
'key' => {
|
|
|
|
'id' => '47B320EB4C7C375AA9DAE1A01054B7A24BD6EC30',
|
|
|
|
'server' => 'pgp.mit.edu',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
2014-01-07 01:53:19 +01:00
|
|
|
class { 'apt':
|
2015-03-18 20:56:29 +01:00
|
|
|
update => {
|
|
|
|
'frequency' => 'always',
|
|
|
|
'timeout' => '400',
|
|
|
|
'tries' => '3',
|
|
|
|
},
|
|
|
|
purge => {
|
|
|
|
'sources.list' => true,
|
|
|
|
'sources.list.d' => true,
|
|
|
|
'preferences' => true,
|
|
|
|
'preferences.d' => true,
|
|
|
|
},
|
2015-06-17 23:56:22 +02:00
|
|
|
sources => $sources,
|
2014-01-07 01:53:19 +01:00
|
|
|
}
|
|
|
|
EOS
|
|
|
|
|
|
|
|
apply_manifest(pp, :catch_failures => true)
|
2014-04-24 09:52:12 +02:00
|
|
|
apply_manifest(pp, :catch_failures => true)
|
|
|
|
end
|
2014-07-31 01:54:28 +02:00
|
|
|
it 'should still work' do
|
|
|
|
shell('apt-get update')
|
2014-10-07 01:44:19 +02:00
|
|
|
shell('apt-get -y --force-yes upgrade')
|
2014-04-24 09:52:12 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-01-09 20:26:59 +01:00
|
|
|
context 'reset' do
|
|
|
|
it 'fixes the sources.list' do
|
|
|
|
shell('cp /tmp/sources.list /etc/apt')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-01-07 01:53:19 +01:00
|
|
|
end
|