group :development, :test do
gem 'rake', '10.1.1', :require => false
gem 'rspec', '~> 2.11', :require => false
- gem 'pry', :require => false
gem 'rspec-puppet', :require => false
gem 'puppetlabs_spec_helper', :require => false
gem 'serverspec', :require => false
# Time to remove it using Puppet
apply_manifest(pp, :catch_failures => true)
- expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
+ apply_manifest(pp, :catch_failures => true)
shell("apt-key list | grep #{PUPPETLABS_GPG_KEY_ID}",
:acceptable_exit_codes => [1])
end
describe 'server =>' do
- context 'pgp.mit.edu' do
- it 'works' do
+ context 'nonexistant.key.server' do
+ it 'fails' do
pp = <<-EOS
apt_key { 'puppetlabs':
id => '#{PUPPETLABS_GPG_KEY_ID}',
ensure => 'present',
- server => 'pgp.mit.edu',
+ server => 'nonexistant.key.server',
}
EOS
- apply_manifest(pp, :catch_failures => true)
- expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
- shell("apt-key list | grep #{PUPPETLABS_GPG_KEY_ID}")
+ apply_manifest(pp, :expect_failures => true) do |r|
+ expect(r.stderr).to match(/(Host not found|Couldn't resolve host)/)
+ end
end
end
- context 'nonexistant.key.server' do
- it 'fails' do
+ context 'pgp.mit.edu' do
+ it 'works' do
pp = <<-EOS
apt_key { 'puppetlabs':
id => '#{PUPPETLABS_GPG_KEY_ID}',
ensure => 'present',
- server => 'nonexistant.key.server',
+ server => 'pgp.mit.edu',
}
EOS
- apply_manifest(pp, :expect_failures => true) do |r|
- expect(r.stderr).to match(/(Host not found|Couldn't resolve host)/)
- end
+ apply_manifest(pp, :catch_failures => true)
+ expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
+ shell("apt-key list | grep #{PUPPETLABS_GPG_KEY_ID}")
end
end
end
describe 'keyserver_options =>' do
context 'debug' do
- it 'works' do
+ it 'fails on invalid options' do
pp = <<-EOS
apt_key { 'puppetlabs':
id => '#{PUPPETLABS_GPG_KEY_ID}',
ensure => 'present',
- keyserver_options => 'debug',
+ keyserver_options => 'this is totally bonkers',
}
EOS
- apply_manifest(pp, :catch_failures => true)
- expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
- shell("apt-key list | grep #{PUPPETLABS_GPG_KEY_ID}")
+ apply_manifest(pp, :expect_failures => true) do |r|
+ expect(r.stderr).to match(/--keyserver-options this is totally/)
+ end
end
- it 'fails on invalid options' do
+ it 'works' do
pp = <<-EOS
apt_key { 'puppetlabs':
id => '#{PUPPETLABS_GPG_KEY_ID}',
ensure => 'present',
- keyserver_options => 'this is totally bonkers',
+ keyserver_options => 'debug',
}
EOS
- apply_manifest(pp, :expect_failures => true) do |r|
- expect(r.stderr).to match(/--keyserver-options this is totally/)
- end
+ apply_manifest(pp, :catch_failures => true)
+ expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
+ shell("apt-key list | grep #{PUPPETLABS_GPG_KEY_ID}")
end
end
end
include apt::unattended_upgrades
EOS
- # Attempted workaround for problems seen on debian with
- # something holding the package database open.
- shell('killall -9 apt-get', { :acceptable_exit_codes => [0,1] })
- shell('killall -9 dpkg', { :acceptable_exit_codes => [0,1] })
+ if fact('operatingsystem') == 'Debian'
+ # Attempted workaround for problems seen on debian with
+ # something holding the package database open.
+ shell('killall -9 apt-get', { :acceptable_exit_codes => [0,1] })
+ shell('killall -9 dpkg', { :acceptable_exit_codes => [0,1] })
+ end
+
apply_manifest(pp, :catch_failures => true)
end